M
mrstephengross
Hi folks... I've got a simple inheritance system (base class & 2
derived classes). In essence it looks like this:
class Base { public:
virtual ~Base() { };
virtual void required_function() = 0; };
class Derived1 : public Base { public:
virtual void required_function() { }
int x;};
class Derived2 : public Base { public:
virtual void required_function() { }
int y;};
I want to store Base*'s in another struct, like so:
struct SomeStruct { Base * base; };
I want to write a copy constructor for SomeStruct so that the Base* is
deep-copied. I know there are a bunch of pointer wrappers out there for
doing so (auto_ptr, etc.). What's the simplest one to use for this
purpose?
Thanks,
--Steve ([email protected])
derived classes). In essence it looks like this:
class Base { public:
virtual ~Base() { };
virtual void required_function() = 0; };
class Derived1 : public Base { public:
virtual void required_function() { }
int x;};
class Derived2 : public Base { public:
virtual void required_function() { }
int y;};
I want to store Base*'s in another struct, like so:
struct SomeStruct { Base * base; };
I want to write a copy constructor for SomeStruct so that the Base* is
deep-copied. I know there are a bunch of pointer wrappers out there for
doing so (auto_ptr, etc.). What's the simplest one to use for this
purpose?
Thanks,
--Steve ([email protected])