Chapter 3. Putting Object-Oriented Programming to Work

Not all object-oriented programming (OOP) concepts are new to Visual Basic. The language has had support for classes and interface-based programming since Version 4, and, arguably, the drag-and-drop controls that have been central to the Visual Basic programming paradigm since Version 1 are a sterling example of what reusable objects can achieve. When you drop a Button control onto a VB 6 form, for example, you create a new instance of the control in a way that is analogous to the way a class is instantiated in a traditional object-oriented language. Likewise, when you set the Caption property of a Button or call the Show method of a form, you perform tasks that are analogous to setting a property or calling a method on an object.

Still, it's hard to argue that VB 6 is a truly object-oriented language. It lacks support for such crucial features such as inheritance, which allows one class to derive its properties and functionality from another. Were that functionality present, for example, you would be able to create your own custom Buttons by deriving from the Button control that ships with VB 6. Interface-based programming is so difficult in VB 6 that few programmers have bothered to master it. VB 6 has no support for defining or working with interfaces, for example, and VB 6 programmers schooled in OOP principles must resort to virtual base classes to achieve the same result.

In the end, many perhaps most Visual Basic programmers have concluded that OOP is arcane and impossibly difficult, and irrelevant to the development of the applications that VB 6 programmers implement every day.

Visual Basic 2005 changes everything, and in this chapter, I'll not only make the case that OOP is a tool that can turbo charge your productivity as a developer, but I'll also show you how VB 2005 now makes it easy to incorporate the best practices of OOP into your applications.

So, let the journey begin!

Visual Basic 2005 Jumpstart 2005
Visual Basic 2005 Jumpstart
ISBN: 059610071X
EAN: 2147483647
Year: 2005
Pages: 86
Authors: Wei-Meng Lee

Similar book on Amazon © 2008-2017.
If you may any questions please contact us: