• Advertisement

Archived

This topic is now archived and is closed to further replies.

dynamic_cast question...

This topic is 5716 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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

Share this post


Link to post
Share on other sites
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]

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites

  • Advertisement