#include #include class MyClass { public: MyClass(int *p) : sptr_(p) { } private: boost::scoped_ptr sptr_; }; int main(int argc, char **argv) { // initialize a scoped_ptr to contain an (int *) boost::scoped_ptr x(new int(10)); // mc's constructor initializes the scoped_ptr in the sptr_ member // variable to contain sevenptr. int *sevenptr = new int(7); MyClass mc(sevenptr); return EXIT_SUCCESS; }