Book Review: Beginning Visual Basic 6 Objects
Our time at DataDamage, in this chapter, has taken us over some of most essential object-oriented development issues within Visual Basic. We've been busy with plenty of program code, and we've taken a real-world programming scenario to explore the object-oriented issues.
Although there's a lot more to come in our journey through object-oriented programming in Visual Basic, we've covered some of the hardest areas already. In particular, we looked at:
Class and Object Interfaces
In the next chapter, we'll have a look at a few more design aspects of object-oriented programming as we discuss object hierarchies.
Why Not Try
1 In the exercise in this chapter where we created a class to browse the Titles table, what was the purpose of raising the event DataChanged in the Reload_Members procedure?
2 When does the procedure Reload_Members take place in the class?
3 In the exercise in the chapter where we created 'properties' for each field in the Titles table, did you find anything unusual about the way we created the properties?
4 In the exercise in this chapter where we designed a class to browse the Titles table, when is the recordset created?
5 In the second exercise in the chapter, where we 'instantiate' an object based on our class, when and where is the object instantiated?
6 In the second exercise in the chapter, where we 'instantiate' an object based on our class, how do we make use of the event DataChanged raised out of the class, and how is it used?
7 Prove to yourself that the code that was written in exercise 2 is really independent of the data source. Is there any way that you can tell whether the underlying data source for the form is an Access table, an Oracle table, a SQL table, or even a flat text file?
8 On a related note, if we were to change the location of the Titles data from a location on a Local Area Network to a remote Database Server, perhaps in the United Kingdom, what would we need to change in order to accomplish this feat?
9 I want to give you a chance to work with the Implements statement here, so that you can see how the Implements statement allows you to implement interface inheritance. In this exercise, you'll create a class, clsPerson, from which you will later, in our next exercise in fact, implement another class called clsCustomer. Create that new class called clsPerson now, with two properties called Name and Address. Then create a method called ShowInfo (sound familiar?).
10 Now create a new class, clsCustomer, that implements the properties and methods of clsPerson.
Page 9 of 9