#include <iostream>
using namespace std;
class B;
class A
{
public:
~A() { cout <<"destroying A\n"; }
public:
B *abp;
};
class B
{
public:
~B() { cout <<"destroying B\n"; }
public:
A *bap;
};
void test()
{
A *ap = new A();
B *bp = new B();
ap->abp = bp;
bp->bap = ap;
}
int main()
{
cout<<"begin test...\n";
test();
cout<<"end test.\n";
system("PAUSE");
return 0;
}