Program of UNARY operator overloading using friend function

/*Program of UNARY operator overloading using friend function*/

#include
#include
class A
{
int a,b;
public:
void getdata(int p,int q)
{
a=p;
b=q;
}
void display()
{
cout<<"\na="<OUTPUT :

a=2
b=3
After operator overloading
a=-2
b=-3







Leave a Reply

Your email address will not be published. Required fields are marked *