#include<iostream.h>
#include<conio.h>
class myclass
{ private:
int a;
public:
myclass(int a1)
{ a=a1;
cout<<"\n\n This is previous value: "<<a;
}
myclass(myclass &obj)
{ a=obj.a;
cout<<"\n\n This is copied value: "<<a;
}
};
void main()
{ clrscr();
myclass m1(333);
myclass m2(m1);
getch();
}
#include<conio.h>
class myclass
{ private:
int a;
public:
myclass(int a1)
{ a=a1;
cout<<"\n\n This is previous value: "<<a;
}
myclass(myclass &obj)
{ a=obj.a;
cout<<"\n\n This is copied value: "<<a;
}
};
void main()
{ clrscr();
myclass m1(333);
myclass m2(m1);
getch();
}
Comments
Post a Comment