Saturday 2 October 2010

overloading the unary plus operator using member function



overloading the unary plus operator using member function

overloading the unary plus operator is as shown below
<header files>
class A
{
int x;
public:
A(int=0);
A operator +();
};

A A :: operator +()
{
return A(+x);
}


friend function

No comments:

Post a Comment