#include<iostream.h>
#include<conio.h>
class Space
{
int x,y,z;
public:
void Getdata(int a, int b, int c);
void Display(void);
void operator -();
};
void Space
:: Getdata(int a, int b, int c)
{
x=a;
y=b;
z=c;
}
void Space
:: Display(void)
{
cout<<x<<" ";
cout<<y<<" ";
cout<<z<<"\n";
}
void Space
:: operator-()
{
x=-x;
y=-y;
z=-z;
}
void main()
{
clrscr();
Space S;
S.Getdata(10,-20,30);
cout<<"s:";
S.Display();
-S;
cout<<"s:";
S.Display();
getch();
}
}
Output