Reputation: 209
I have such a code:
class Base { ... };
class Derived : public Base
{ ... };
boost:shared_ptr<Base> p;
int main()
{
p(new Derived);
...
}
It seems to me that this isn't working. What am I missing?
Upvotes: 0
Views: 299
Reputation: 96845
You're confusing in class initialization with assignment. The member-initializer list syntax only works inside of the class body:
p = boost::make_shared<Derived>();
Upvotes: 2