Jump to content
  • Advertisement
Sign in to follow this  
CoMaNdore

boost shared_ptr typecast?

This topic is 4458 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

Hey I got these classes 'BaseObject' 'TreeNode' and 'Entity' Entity is a child of TreeNode that again is a child of BaseObject. both are declared as
typedef boost::shared_ptr<BaseObject> BaseObjectPtr;
typedef boost::shared_ptr<TreeNode>   TreeNodePtr;
typedef boost::shared_ptr<Entity>     EntityPtr;
Now I got a BaseObjectPtr and want to upcast it into EntityPtr. like:
BaseObjectPtr pBase( new Entity );

// throws a compiler error, at least at my compiler..
EntityPtr pEntity = pBase;
A example how to achive this would be nice :D Thanks in advance...

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!