
12 Jul
2006
12 Jul
'06
7:25 a.m.
hello given the following class hierarchy class Foo { protected: virtual ~Foo() {} }; class Bar : public Foo {}; and declaration boost::shared_ptr<Foo> foo; is there any difference between the two assignment statements below? foo = boost::shared_ptr<Foo>(new Bar); foo = boost::shared_ptr<Bar>(new Bar); in other words, when you assign a value to a shared_ptr, does it make any difference what class you specify for that value, as long as the class of the underlying object can be dynamically cast to the class that was used to declare the shared_ptr? kind regards, eric