Hi there, recently I encounter a problem about circularly linked objects. Following are two classes declared in my small engine. Node is basically a hierarchical representation of transformation, and Entity is object in the game scene. Every Entity must have a node, each node can have several child nodes. What I want to do is deleting either of entity or node will delete both of them, and also deleting a node will somehow notify its parent. Could anyone help with this? or is there a better structure to organize relationship between hierarchical transformation and game object? Thanks in advance.
Class Entity
{
~Entity()
{}
Node *m_node;
}
Class Node
{
~Node()
{}
Node *m_parent;
vector<Node *> m_children;
Entity *m_entity;
}