class hirachy problem

Kristian Kratzenstein kristian.kratzenstein@kielnet.net
Mon Dec 5 16:31:00 GMT 2005


Hello,

I've a questions c++ related :
I'm using a list of classes, which are based all on the same class. I cast
those children classes back into parant class for more easy transport.

class CAlpha
{
....
}

template <T_Any>
class CBetaT : public CAlpha
{
....
}

class CGamma
{
....
}

void main(void)
{
	CAlpha* a = (CAlpha*)new CBeta<CGamma>;
}

Now I like to call a template function ( funcT(CBeta<T_Any> &b) ) but at
the point where I do this, I do not now anymore, which children class I
initialized.
I could test with a list of dynamic_cast<>.

Is there a more easy way to implement this ?

kind regards,

Krisitna Kratzenstein

--------------------------------------------
Kristian Kratzenstein
Gettorf

Kristian.Kratzenstein@KielNET.net
--------------------------------------------



More information about the Gcc-help mailing list