.
Home About-us Privacy Policy Contact-us Services

Thursday, October 8, 2015

C++ Program to concept of dynamic constructor

ad+1

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

Home About-us Privacy Policy Contact-us Services
Copyright © 2014 All Programs Examples | All Rights Reserved. Blogger Templates Download Blogger Templates