Saturday, 2 October 2010

Unary plus operator overloading using friend function



Unary plus  operator overloading using friend function:

<header files>
class A
{
int x;
A(int=0);
public:
friend A operator +(const A&);
};
A  operator +(const A& Aobj)
{
return A(+A obj .x);
}


friend function

No comments:

Post a Comment