Original Post
I have 2 classes, A and B, and i want A to have a child/instance of B, but B know who its father/owner is. For this, I wrote something like the following code (which is really simplified for understanding reasons), but it crashes MS C++.NET. (at run-time)
class A;
class B
{
friend class A;
A *owner;
};
class A
{
friend class B;
B *child;
A()
{
if(child==NULL) child = new B;
child->owner = this;
}
};
What could be wrong, and how could I fix it?
plz help. 10x.