C++: overloading operators?
Example:
class Complex {
int real, imag;
};
Operator overloading allows operators to work with user-defined types.
Solution:
Complex operator + (Complex const &obj) {
Complex temp;
temp.real = real + obj.real;
temp.imag = imag + obj.imag;
return temp;
}