9.4. Default and Parameterless Constructors

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 ...

Get Visual Basic 2005 for Programmers: Deitel Developer Series, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.