Https://ide.codingblocks.com/s/64268

https://ide.codingblocks.com/s/64268

Sir,
i made a class in it and overloaded = operator.
But i am not able to make any global function that would return by value the class data member.
please refer to my code sir

???
sir help please

Hi Bhavya, there is some error in the way you’re trying to overload the = operator. The error is not in the global/local scope because if we comment out lines number 20-24, the rest of the code works fine and 4 is produced as an output as normal = operator would produce. So, try to work on the line 20-24 of your code.

yes mam, c++ inbuilt = operator return by value
i tried making such operator but then it gives error

i think the error might be due to copy constructor using pass by reference

https://ide.codingblocks.com/s/65666