|
Boost Users : |
From: eric (spamsink42_at_[hidden])
Date: 2006-07-12 03:25:52
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
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net