Sign in to follow this  
CoMaNdore

boost shared_ptr typecast?

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this