i.e.
class A {
public:
A(Apar1, Apar2, Apar3 /* and so on ... */);
};
class B {
public:
B(Bpar1, Bpar2, Bpar3 /* and so on ... */);
};
class C {
public:
// C();
private:
A m_a;
B m_b;
};
where C construct depends on A and B, so
-
the constructor of
Cmust be the following signature?C::C(Apar1, Apar2, Apar3, Bpar1, Bpar2, Bpar3) -
How can I construct
Cin a natural way?
You could create a constructor like this instead:
Whether or not you find this more natural or not is a matter of taste,