
12 Jul
2006
12 Jul
'06
2:22 p.m.
eric wrote:
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);
No, the first form is a shorthand for the second form, and so is foo.reset( new Bar );