* Chameleon:
-------------------
class A {
public:
A() { blabla(); }
A(int a) : A() { another_blabla(); } // why wrong?
}
-------------------
I want 2nd ctor, runs content of 1st ctor and after its content.
In Java, I must use in first body line of A(int a) this:
You can
* Wait for the next version of the standard, C++0x.
* Use an "init" member function or functions (sometimes OK, sometimes
Evil) called from the constructor or constructor init list.
* Use an "init" member function called by client code after
construction. This idea, called two-phase construction, is
unspeakably evil and will cause you no ends of problems. But some
fail to recognize the connection with the problems they have (folks
doing embedded programs or old MFC are least ulikely to be blind
that way, because their tools almost force spaghetti on them).
* In some cases, simply use defaults for constructor arguments,
thus collapsing two or more constructors into one.
* Introduce an artificial base class, and place the common
constructor functionality there.
There is FAQ item on this, but last I checked that FAQ item was very
much less than complete in its coverage.