June 2006
Intermediate to advanced
1344 pages
42h 52m
English
If 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 constructor—called a parameterless constructor—that contains code (but, again, takes no parameters), as we demonstrated in class Time (lines 13–15 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
|
| If Public constructors are provided for a class, but ... |
Read now
Unlock full access