Czy takie rozwiązanie jest poprawne?
class Base
{
public:
Base()
: m_Foo(0)
{}
int GetFoo() { return m_Foo;}
void SetFoo(int foo) { m_Foo = foo; }
private:
int m_Foo;
};
class Delivery: public Base
{
public:
Delivery()
: Base(), m_Bar(0)
{}
Delivery(std::shared_ptr<Base> b)
: Base(*b.get()), m_Bar(0)
{}
int GetBar() { return m_Bar;}
void SetBar(int foo) { m_Bar = foo; }
private:
int m_Bar;
};
Pytam o przekazanie shared_ptr w parametrze konstruktora dla klasy pochodnej.