Q:

which is the better place to initialize the base class member variables?

class A // abstract class
{
protected:
    int m_iA;
    int m_iB;
    int m_iC;
    int m_iD;
    int m_iE
    ~A();
};

class B : public A // abstract class
{
protected:
    double m_dA;
    double m_dB;
    double m_dC;
    double m_dD;
    ~B();
};

class C : public B
{
public:    
    C(int iA, int iB, int iC, int iD, int iE, double dA, double dB, double dC, double dD)
    {

    }
}

Question> As you can see above example, both base class A and B contain many member variables. What is the better solution to pass those initial values from class C up to the base classes?
Method1> Assign the base class member variables directly inside the constructor body of class C.
Method2> Pass all initial values from constructor of C to B, and then finally to A.
Thank you

A:

I would recommend making constructors for A and B, and have them take the initialization values, and apply them.  Then C calls B's constructor, passing values to it, and so on.  This way if there is ever another class inheriting from B or A, it follows the same pattern, and this can be enforced, by only having constructors that require initialization values.

