Hi,
I’m using TClass::New() in one of my projects right now, and it seems to be working, but given some of the comments I’ve seen on this board I’m a little scared of it. So…
Say I have a object that derives from TSelector: class MySel : public TSelector
{... };
am I safe (always safe, no matter what) writing the following? TClass *c = TClass::GetClass("MySel");
TSelector *s = reinterpret_cast<TSelector*>(c->New());
In general, say I have a TClass object, and the class it represents I know inherrits from TObject - but I know nothing more - not how many other classes inherrit from TObject, or how the multiple inherritance hierarchy looks, etc. Further, as above, at compile time I don’t know the type that I can tell the compiler about… is there any way I can safely write the following? If not, what can I write to get the TObject pointer? TObject *o = reinterpret_cast<TObject*>(c->New());
Many thanks in advance!
Cheers,
Gordon.