When inheritance, do the variables in the base class get copied into the derived class? how the architecture of the child class would be?
{
public:
int m_id;
Base(int id=0)
: m_id(id)
{
}
int getId() const { return m_id; }
};
class Derived: public Base
{
public:
double m_cost;
Derived(double cost=0.0)
: m_cost(cost)
{
}
double getCost() const { return m_cost; }
};
does m_id get copied into derived while derived object's instantiation ?