boost shared_ptr typecast?

Started by
0 comments, last by snk_kid 18 years, 1 month ago
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...
- Me
Advertisement
boost::static/dynamic_pointer_cast

This topic is closed to new replies.

Advertisement