#include<iostream>
using namespace std;
class unary
{
int x,y,z;
public:
void getdata(int a,int b,int c);
void display(void);
void operator -();
};
void unary ::getdata(int a,int b,int c)
{
x=a;
y=b;
z=c;
}
void unary::display(void)
{
cout<<x<<" "<<y<<" "<<z<<"\n";
}
void unary::operator -()
{
x=-x;
y=-y;
z=-z;
}
int main()
{
unary u;
u.getdata(20,-30,40);
cout<<"u:";
u.display();
-u;
cout<<"u:";
u.display();
return 0;
}
OUTPUT:
BY
REGU RAM SV.
Post a Comment