Hi
Say that I have :
Code:
#include <iostream>
class base{};
class derived1 :public base{};
class derived2 : public base{};
class double_derived : public derived1{};
int main()
{//code
return 0;
}
Can I in some way have manipulate that hierarchy as tree. More specifically without knowing the children derived1 , derived2 and double_derived ( I know only the root node base ) to parse the tree and create objects for each class. A nice output would be to show me the full hierarchy ( base is the root , derived1 inherit from base , derived2 inherit from base, double_derived inherit from derived1 ) Then while I know the children ( class ) to be able to create objects .
In deeper my problems is
1)How can I pass from the root to children ( RTTI provide the class that belongs an object and the before() function compares already known objects and classes ) WHAT I NEED is to find the class and subclasses dynamically through parsing tree
2)If in some way I find the names of classes , how can I dynamically create objects ? This is a problem because objects declared at compilation time
3)Is there any way C++ to answer in that question : What is the objects of class X and what are the subclasses of class X
Thanks