Write a program to overload the ‘—’ unary operator to negate the values.
#include<iostream.h>
#include<conio.h>
#include<string.h>
class Number
{
int x,y;
public:
Number (int a, int b)
{
a =x;
b =y;
}
void display()
{
cout<<"value of x=”<<x<<”\n Value of y= ”<<y;
}
void operator - ( )
{
x = - x;
y = - y;
}
};
void main ()
{
Number N1(5,6);
clrscr ();
N1. display ();
-N1;
cout<<"\n After negation:";
N1. display ();
getch ();
}