C++ Program for Unary Operator minus
//Unary Operator minus
#include
#include
class minus
{
int d1,d2,d3;
public:
minus()
{d1=d2=d3=0;}
minus(int a,int b,int c)
{
d1=a;
d2=b;
d3=c;
}
void display(void)
{
cout<
void operator - ()
{
d1=-d1;
d2=-d2;
d3=-d3;
}
};
void main()
{
clrscr();
minus o1,o2(2,4,6);
-o1;
cout<<"\nData of Object 1 : ";
o1.display();
-o2;
cout<<"\n\nData of Object 2 : ";
o2.display();
getch();
}