Program -
#include<iostream.h>
#include<conio.h>
class abc
{
int rn;
float fees;
public:
abc(int a,float b)
{
rn=a;
fees=b;
}
abc(abc&m)
{
rn=m.rn;
fees=m.fees;
cout<<"\n copy constructor at work";
}
};
void main()
{
clrscr();
float x,y;
cout<<"\n enter the rollno of
student";
cin>>x;
cout<<"\n enter the fees of
student";
cin>>y;
abc m1(x,y);
cout<<"\n rollno and fees
is"<<x<<"and"<<y;
getch();
}
Output -
enter the rollno of student 9
enter the
fees of student 1000
rollno and
fees is 9 and 1000
0 comments:
Post a Comment