Transcript

Slide 1

Operator overloading: Overloading a unary operator issimilar to overloading a binary operator except that there is oneOperand to deal with. When you overload a unary operator usinga member function, the function has no parameters. Since, thereis only one operand, it is this operand that generates the call tothe operator function. There is no need for another parameter.

/* Program of Unary operator*/

#include#includeclass complex{ int a,b,c; public: complex(){}

void getvalue() { cout


Top Related