Visual Basic 2008 Programming: Business Applications with a Design Perspective
Chapter 1 Chapter 2 Chapter 3 Chapter 4 Chapter 5 Chapter 6 Chapter 7 Chapter 8 Chapter 9
Chapter 10 Chapter 11 Chapter 12 Chapter 13 Chapter 14 Appendix A Appendix B Appendix C Home
Last change: February 13 2016 18:48:19.

 Chapter in PDF

Table of Contents

Chapter 12: Object-Based Programming
Last change: February 13 2016 18:48:25.

12.3 Adding Features to the Class

Perhaps you have noticed some desirable improvements in the preceding example. This section considers several of these improvements.
This textbook has advocated for the use of meaningful names for both constants and variables. The depreciation (accounting) methods were coded with numbers: 0 for no depreciation and 1 for the straight-line depreciation method. Is there a way to represent these numbers with meaningful names? Yes, you can with the Enum statement.

Last change: February 13 2016 18:48:25.
  1. Differences Between the Class Module and the Standard Module
  2. Adding a Class Module to a Project
  3. Creating the Fixed Asset Class
  4. Creating a Property
  5. Creating a Method
  6. Using the FixedAsset Class
  7. Default Property Setting and the Constructor
  8. Building and Using a Class: A Recapitulation
  • 12.3 Adding Features to the Class
    1. Enumerated Constants
    2. Throwing Exceptions
    3. Implementing Events in a Class
    4. A Class with an Event: An Example
    5. Hooking Event Handlers
    6. <<PreviousNext>>