// Creating parent and child RenderObjects RenderObject* parentObject = new RenderObject(); RenderObject* childObject = new RenderObject(); // Adding child to parent parentObject->addChild(childObject);
// Creating top level parent Object RenderObject* topLevelObject = new RenderObject(); // Creating two child objects RenderObject* childObject1 = new RenderObject(); RenderObject* childObject2 = new RenderObject(); // Creating grandchild object RenderObject* grandchildObject = new RenderObject(); // Adding grandchild to child1 and child1 and child2 to topLevelObject childObject1->addChild(grandchildObject); topLevelObject->addChild(childObject1); topLevelObject->addChild(childObject2);In both examples, the package library used is likely a rendering engine or graphics library such as OpenGL or DirectX, which provides a RenderObject class with the addChild function.