My concern is a default constructor and its initialisation list. In a simple case it’s clear, like:
class A
{
protected:
double d1;
//classB obj1; //how to initialize this one in a default constructor?
public:
A (double x = 0.0): d1(x){} //constructor
virtual ~A(void) {};
//something
}
But how to initialize the object of classB, which has a big amount of members? Or how in general initialize in default constructor some type that has a big or unknown amount of parameters to be initialized?
You could initialize obj1 in
member initializer listby calling its default constructor or other constructorsif classB has big of members like you described, you may break the rule of class design –
one class does one thing. You might want to break classB into small independent classes.