A constructor can call another constructor in the initialiser list which heavily reduces writing boilerplate:
class MyClass {
public:
// Target constructor.
MyClass(int x, char y) : x(x), y(y) {}
// Delegating constructor to target constructor.
MyClass(int x) : MyClass(x, 'y') {}
// Delegating constructor to target constructor.
MyClass(char y) : MyClass(1, y) {}
private:
int x;
char y;
};
You cannot use constructor delegation together with member initialisation:
MyClass(int x) : MyClass(x), y('y') {}
Dan