B
barcaroller
I have an object ObjA of class ClassA. However, depending on the contents
of ObjA's data fields (which I do not know until the program runs), I would
like this object to be also of class ClassB. ClassB has member functions
which I need but which are relevant only if ObjA has specific contents in
its data fields.
Given that C++ is a statically-typed language, I don't know of a
straight-forward way of implementing this. Can it be done?
of ObjA's data fields (which I do not know until the program runs), I would
like this object to be also of class ClassB. ClassB has member functions
which I need but which are relevant only if ObjA has specific contents in
its data fields.
Given that C++ is a statically-typed language, I don't know of a
straight-forward way of implementing this. Can it be done?