Dear you,
I have a question a bout TClass::New(…), this maybe a silly question, but useful for me.
I have a code like this,
const char* cname = "UserClassName";
//by useing the TClass::New(..) method, I can create an object of 'UserClassName'
void *obj = gROOT->GetClass(cname)->New(0);
the ‘obj’ is a ‘void*’ type, my question is how can I cast ‘obj’ to it’s true type ‘UserClassName’ [color=#FF0000] by using the value of ‘cname’[/color].
I mean I want to do something like:
(static_cast<cname>(obj))->somemethod(...);
if I do not cast ‘obj’ to it’s true type, I can not excute it’s member functions.
Any help or advice is appreciated!
Han