//hi i saw an example of the + operator overloaded and i see that that operator+ function returns a constructor what is the logic behind this?
thanks for any helpCode:Class MyClass{ public: MyClass(int);//constructor ... //+ operator overloaded MyClass operator+(const MyClass &objetc)const { //how this can work and why? return MyClass(localData + object.localData) } ... }; int main() { MyClass n1; MyClass n2(20); Mclass n3(6); n1 = n2+n3; return 0; }