#include<iostream>
using namespace std;
class SPACE
{
int x,y,z;
public:
SPACE()
{
x=10;
y=11;
z=12;
}
SPACE operator -()
{
SPACE ob;
ob.x = -x;
ob.y = -y;
ob.z = -z;
return ob;
}
void display()
{
cout<<"\nX is: "<<x<<"\nY is: "<<y<<"\nZ is: "<<z;
}
};
int main()
{
SPACE ob1,ob2;
ob1.display();
ob2=-ob1;
ob2.display();
return 0;
}
using namespace std;
class SPACE
{
int x,y,z;
public:
SPACE()
{
x=10;
y=11;
z=12;
}
SPACE operator -()
{
SPACE ob;
ob.x = -x;
ob.y = -y;
ob.z = -z;
return ob;
}
void display()
{
cout<<"\nX is: "<<x<<"\nY is: "<<y<<"\nZ is: "<<z;
}
};
int main()
{
SPACE ob1,ob2;
ob1.display();
ob2=-ob1;
ob2.display();
return 0;
}
No comments:
Post a Comment