I have a class derived from a base class with a constructor. This class itself has its own constructor to initialize its private members which consist solely of objects of another class which is derived from the same base class. My problem is that I have no clue how to declare and define the constructor in the header file and implementation file to initialize the values of the class objects. This is something similar to what I am looking at:
class Base
{
public:
Base(const string& name, constint& age);
//More functions
private:
string TheName;
int TheAge;
}
class DerivedOne : public Base
{
public:
DerivedOne(const string& name, constint& age, constint& height, constint& weight);
//More functions
private:
int TheHeight;
int TheWeight;
}
class DerivedTwo : public Base
{
public:
DerviedTwo(const string& name, constint& age, //Unsure how to complete this declaration
//More functions
private:
DerivedOne Object1;
DerivedOne Object2;
DerivedOne Object3;
}