9.4. Default and Parameterless ConstructorsIf a class does not define constructors, the compiler provides a default constructor. This constructor contains no code (i.e., the constructor body is empty) and takes no parameters. You can also provide a constructorcalled a parameterless constructorthat contains code (but, again, takes no parameters), as we demonstrated in class Time (lines 1315 of Fig. 9.1), and as we will see again in the next example. If you provide any constructors for a class, the compiler will not provide a default constructor for that class. Common Programming Error 9.2
|