Boost logo

Boost Users :

From: Johan Råde (rade_at_[hidden])
Date: 2006-11-20 10:39:24


Martin Waller wrote:

> #include <MyClass.hpp>
> #include <someOtherClass.hpp>
>
> MyClass::MyClass()
> {
> init();
> }
>
> void MyClass::init()
> {
> spOther(new someOtherClass(this));

You can not call a constructor here.
spOther has already been default constructed.
Instead you should use the reset member function:

     spOther.reset(new someOtherClass(this));

> }
>
>
>


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