I've been practicing inheritance and I found myself asking what a "has-a" relationship is really about.
If I have a class circleType
and I want to create a class cylinderType
, whats the difference between deriving cylinderType
from circleType
and just including a circleType
object member in the definition of cylinderType
class cylinderType :
public circleType
{
public:
cylinderType();
~cylinderType();
private:
double * height;
};
OR:
class cylinderType
{
public:
cylinderType();
~cylinderType();
private:
circleType baseOfCylinder;
};