Code:
#include <conio.h>
#include <iostream.h>
struct phanso
{
int tu;
int mau;
};
class test
{
phanso *p;
public:
void xuat();
test();
test(const test& X );
~test();
};
test::~test ()
{
cout<<"daaaang huy:...";
}
void test::xuat()
{
cout<<endl<<p->tu<<"/"<<(*p).mau<<endl;
cout<< this;
}
test::test()
{
p->tu=5;
(*p).mau=10;
}
test::test(const test& X)
{
// p=new phanso;
// (*p).tu=X.p->tu;
// (*p).mau=X.p->mau;
test *c=new test;
c->p->tu = X.p->tu;
(*c).p->mau= X.p->mau;
delete c;
}
void main()
{
clrscr();
test a;
a.xuat();
test b(a);
b.xuat();
cout<<endl<<"hettttttttttttttt";
getch();
}
