Beginning Visual Basic 2005 (2006)
.pdf
10
Building Objects
You may have heard the term object-oriented a lot since you first started using computers. You may also have heard that it is a scary and tricky subject to understand. In its early years it was, but today’s modern tools and languages make object orientation (OO) a wonderfully easy-to- understand concept that brings massive benefits to software developers. This is mainly because languages such as Visual Basic, C++, and of course Visual Basic 2005 and C# have matured to a point where they make creating objects and the software that uses them very easy indeed. With
these development tools, you will have no problem understanding even the most advanced objectoriented concepts and will be able to use them to build exciting object-based applications.
You have been using objects and classes throughout this book, but in this chapter you’ll look at object orientation in detail and build on the foundations of the previous chapters to start producing some cool applications using Visual Basic 2005.
In this chapter, you will:
Build a reusable object with methods and properties
Inherit the object that you build in another object
Override methods and properties in your base object
Create your own namespace
Understanding Objects
An object is almost anything you can think of. We work with physical objects all the time: televisions, cars, customers, reports, light bulbs — anything. In computer terms, an object is a representation of a thing that we want to manipulate in our application. Sometimes, the two definitions map exactly onto each other. So, if you have a physical car object sitting in your driveway and want to describe it in software terms, you build a software car object that sits in your computer.
