9.2. Time Class Case Study
We begin with a substantial application that uses most of the object-oriented programming concepts presented in Chapters 4 through 8. We introduce the Object class, the ultimate “ancestor” of all classes in Visual Basic. Also, we explain method ToString, which can be used to obtain a String representation of any Visual Basic object.
Time Class Declaration
The application consists of classes Time (Fig. 9.1) and FrmTimeTest (Fig. 9.2). Class Time contains the information needed to represent a specific time in two popular formats. Class FrmTimeTest represents a GUI for class Time.
Figure 9.1. Time class declaration maintains the time in 24-hour format.
1 ' Fig. 9.1: Time.vb 2 ' Represents time to clients in 12-hour and ... |
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.