header files
class minus
{
int a,b,c;
public:
void get();
{
a=10;
b=-20;
z=30;
}
void operator-()
{
a=-a;
b=-b;
c=-c;
}
void display()
{
cout<<"A=" << a <<"\n";
cout<<"B=" << b <<"\n";
cout<<"C=" << c <<"\n";
}
};
void main()
{
clrscr();
minus obj;
obj.get();
obj.display();
-obj;
obj.display();
getch();
}
Output will be
A=-10
B=20
Z=-30
Tuesday, April 28, 2009
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment