#include<iostream.h>
#include<conio.h>
class Numbers
{
int x;
int y;
int z;
public:
void accept(int a,int b,int c)
{
x=a;
y=b;
z=c;
}
void disp()
{
cout<<"x = "<<x<<"\n";
cout<<"y = "<<y<<"\n";
cout<<"z = "<<z<<"\n";
}
void operator -()
{
x=-x;
y=-y;
z=-z;
}
};
int main()
{
Numbers n;
clrscr();
n.accept(10,20,30);
n.disp();
-n;
cout<<"\nAfter negation the numbers are : "<<"\n";
n.disp();
getch();
return(0);
}
Post a Comment