Section 9.15. Wrap-Up


9.15. Wrap-Up

This chapter investigated the object-oriented programming concepts of classes, objects, methods and instance variables in more depth. The Time class case study presented a complete class declaration consisting of Private data, overloaded constructors for initialization flexibility, properties with Set and Get accessors for manipulating the class's data, and methods that returned String representations of a Time object in two different formats.

We showed how the Me reference is used implicitly in a class's non-Shared methods to access the class's instance variables and non-Shared methods. We also showed how to use the Me reference explicitly to access the class's shadowed instance variables explicitly.

You learned that a class can have references to objects of other classes as membersa concept known as composition. We discussed how garbage collection reclaims the memory of objects that are no longer needed. You learned how to execute the garbage collector to invoke the method Finalize on each object before it is removed from memory. We explained the motivation for Shared instance variables in a class, and demonstrated how to declare and use Shared variables and methods in your own classes. You learned how to declare and initialize Const and ReadOnly variables. We showed how to use the Object Browser to learn the functionality provided by the classes of the Framework Class Library. We also showed how to create a class library for reuse and how to use the classes of the library in an application.

In the next chapter, we continue our discussion of classes by introducing a form of software reuse called inheritance. We will see that classes often share common attributes and behaviors. In such cases, it is possible to define those attributes and behaviors in a common "base" class and "inherit" those capabilities into new class declarations.



Visual BasicR 2005 for Programmers. DeitelR Developer Series
Visual Basic 2005 for Programmers (2nd Edition)
ISBN: 013225140X
EAN: 2147483647
Year: 2004
Pages: 435

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net