Relative Content

Tag Archive for c++overloading

C# += operator overloading issues

I’m trying to overload operator += .. of course this’s not possible by code but If I have not been fooled by docs once overloaded the + operator the += operator will be implicity overloaded.

Operator overloading inside or outside class in c++

I have an exam on programming techniques in c++ and and one common question is wether a certain operator should be overloaded inside the class as a member function , outside a class as a friend or we can do both. I know that + , – , * / can be either. I know that >> << can only be outside of the class and i know that [] and -> have to be inside the class . The ones i dont know and i cant seem to find somewhere are = , != and =. Where should we overload these operators and why .