class hirachy problem

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxx
--------------------------------------------


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux