Home Segments Index Top Previous Next

180: Mainline

Good programming practice dictates that you should include a definition for a default constructor in every class that you define. The rationale is that C++ defines a default constructor for you if you do not define one, and it is better to have a default constructor that is visible and explicit than to have one that is invisible and implicit.

Note, however, that you can define default constructors that do not initialize member variables or perform any other computation; you can define default constructors with empty bodies.