Created
November 6, 2011 16:08
-
-
Save flyingmutant/1343084 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <boost/scoped_ptr.hpp> | |
#include <boost/scoped_array.hpp> | |
class Foo | |
{ | |
public: | |
Foo(size_t j): i(new int[j]) {} | |
virtual ~Foo() {} | |
private: | |
boost::scoped_array<int> i; | |
}; | |
class Bar: public Foo | |
{ | |
public: | |
Bar(size_t j): Foo(j), i(new char[j]) {} | |
private: | |
boost::scoped_array<char> i; | |
}; | |
int main() | |
{ | |
boost::scoped_ptr<Foo> f(new Foo(100)); | |
boost::scoped_ptr<Foo> b(new Bar(200)); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment