Program -
#include<iostream.h>
#include<conio.h>
class abc
{
private:
int a;
float b;
public:
abc(int x,float y)
{
a=x;
b=y;
}
abc(abc&m)
{
a=m.a;
b=m.b;
}
void write(void)
{
cout<<a<<endl;
cout<<b;
}
};
void main()
{
clrscr();
abc m(20,4.2);
abc m2(m);
abc m3=m;
m.write();
m2.write();
m3.write();
getch();
}
Output -
20
4.220
4.220
4.2
0 comments:
Post a Comment