#include<iostream.h>
#include<conio.h>
class Unary
{
int a,b,c;
public:
void operator--();
void getdata(int x, int y, int z)
{
a=x;b=y;c=z;
}
void display(void)
{
cout<<"\ta = "<<a;
cout<<"\tb = "<<b;
cout<<"\tc = "<<c;
}
};
void Unary::operator--()
{
a--;
b--;
c--;
}
int main()
{
Unary u;
u.getdata(5,10,15);
cout<<"Before :\n";
u.display();
--u;
cout<<"\nAfter Decrement :\n";
u.display();
getch();
}
#include<conio.h>
class Unary
{
int a,b,c;
public:
void operator--();
void getdata(int x, int y, int z)
{
a=x;b=y;c=z;
}
void display(void)
{
cout<<"\ta = "<<a;
cout<<"\tb = "<<b;
cout<<"\tc = "<<c;
}
};
void Unary::operator--()
{
a--;
b--;
c--;
}
int main()
{
Unary u;
u.getdata(5,10,15);
cout<<"Before :\n";
u.display();
--u;
cout<<"\nAfter Decrement :\n";
u.display();
getch();
}
No comments:
Post a Comment