#include<iostream.h>
#include<conio.h>
class space
{
int x;
int y;
int z;
public:
void getdata(int a,int b,int c);
void display();
void operator-();
};
void space::getdata(int a,int b,int c)
{
x=a;y=b;z=c;
}
void space::display()
{
cout<<"x="<<x<<", y="<<y<<", z="<<z;
}
void space::operator-()
{
x=-x;
y=-y;
z=-z;
}
void main()
{
space s;
s.getdata(10,-20,30);
clrscr();
cout<<"\ncoordinate of a point in space:\n";
s.display();
-s;
cout<<"\ncoordinate of a point in space of mirror image:\n";
s.display();
getch();
}
No comments:
Post a Comment