
(g++ 3.3.5, boost 1.32) I have a program as follows: Header: //multiple include guard omitted for clarity #include <boots/shared_ptr> class someOtherClass; class MyClass { public: MyClass(); void init(); . . . private: boost::shared_ptr <someOtherClass> spOther; . . . }; Implementation #1: #include <MyClass.hpp> #include <someOtherClass.hpp> MyClass::MyClass() { init(); } void MyClass::init() { spOther(new someOtherClass(this)); } Implementation #2: #include <MyClass.hpp> #include <someOtherClass.hpp> MyClass::MyClass():spOther(new someOtherClass(this)) { } Question: Why does implementation #2 fail to compile with the error: error: no match for call to '(boost::shared_ptr<someOtherClass>)(someOtherClass*)' ? yet implementation #2 compiles fine? Please help me understand what going on here...is it possible to get implementation #2 to compile or is it 'bad code'? Thanks