dynamic_cast question...

Started by
1 comment, last by jonnii 21 years, 10 months ago
I have a question regarding casting from one class to another... Basically i have a class called CEntity, which inherits from CObject, IRenderable and IMoveable and ICollidable... however i want a storage class that stores a pointers to CObject classes, like: CObject *m_object = new CEntity(); for example... but when i want to access my CEntity class functions are hidden because the class has not yet been cast to a CEntity, right? So i tried CEntity *e = dynamic_cast{m_object); but that didnt work... what am i doing wrong? thanks -jonnii
-jonnii=========jon@voodooextreme.comwww.voodooextreme.com
Advertisement
Bah, damn gamedev broken angle-bracket parser...

Always give the actual error you get, not "it doesn't work".

Try dynamic_cast<CEntity *>(m_pObject);


[edited by - Anon Mike on June 27, 2002 2:35:10 PM]
-Mike
1. i fixed the problem. i didnt have RTTI turned on (duh!).

2. i sound like a n00b in that question, so ignore it!!

-jonnii
-jonnii=========jon@voodooextreme.comwww.voodooextreme.com

This topic is closed to new replies.

Advertisement