#include<iostream>
#include<conio.h>
using namespace std;
class like
{
float a,b,c;
public:
like();
like(int x,int y);
like(int x,int y,int z);
void disp();
};
like::like()
{
a=b=c=200;
}
like::like(int x,int y)
{
a=x+x;
b=y+y;
c=x+y;
}
like::like(int x,int y,int z)
{
a=z-y-x;
b=y-z;
c=z-y;
}
void like::disp()
{
cout<<"\nvalue of A is :"<<a;
cout<<"\nvalue of B is :"<<b;
cout<<"\nvalue of C is :"<<c;
}
int main()
{
like A;
like B(100,200);
like C(200,300,500);
cout<<"\nObject A";
A.disp();
cout<<"\nObject B";
B.disp();
cout<<"\nObject C";
C.disp();
getch();
return 0;
}
No comments:
Post a Comment