#include<iostream.h>
#include<conio.h>
class sample
{ public:
int i,j;
sample(int a,int b)
{
i=a;
j=b;
}
sample(sample&S)
{
j=S.j;
i=S.j;
cout<<"copy constructor\n"<<i<<"\n"<<j<<"\n";
}
void show()
{
cout<<"void show\n"<<j;
}
};
void main()
{
clrscr();
sample S(7,6);
sample s1(S);
S.show();
getch();
}
#include<conio.h>
class sample
{ public:
int i,j;
sample(int a,int b)
{
i=a;
j=b;
}
sample(sample&S)
{
j=S.j;
i=S.j;
cout<<"copy constructor\n"<<i<<"\n"<<j<<"\n";
}
void show()
{
cout<<"void show\n"<<j;
}
};
void main()
{
clrscr();
sample S(7,6);
sample s1(S);
S.show();
getch();
}
No comments:
Post a Comment