In C++: assume I have a class X. Is there any difference between private inheritance like this:
class Deriv : private X
{
public:
//constructor etc
void method()
{
usageOfMethodFromX();
}
};
and this:
class Deriv
{
private:
X * m_xinstance;
public:
//constructor etc
void method()
{
m_xinstance->usageOfMethodFromX();
}
};
Is there any difference that does not allow substitute private inheritance with having a member of derived class and vice versa? Is this the same?
Thanks!