Hi,
I have Class A with a virtual function Test() and Class B with virtual function Test().
No I save A and B to a root file. I can get the classtype of each key with GetClassName, but how can I store EACH class in a pointer variable of Class A ?? I must do a type cast when I call File->Get() and this must be in a way DYNAMIC.
An Example:
I want:
ClassA* Base;
Base=(ClassA*)File->Get("ClassA");
Base->Test(); (calls Test() of ClassA)
Base=(ClassB*)File->Get("ClassB");
Base->Test(); (calls Test() of ClassB)
But I dont KNOW at compile time what contents File has so it should be something like:
ClassA* Base;
Base=(key->GetClassName()*)File->Get("ClassA");
But this is of course no valid C++ code !
What is the correct way ?
Joe
This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:50:40 MET