Chapter 16. Class Properties


You will learn about the following in this chapter:

  • Class properties and their purpose

  • The different access specifiers that can be used with properties

  • How class properties form part of the user interface

The CPassword class example in Chapter 15, "Encapsulation," uses class members that you never need to read or write directly. That is, in Chapter 15 you never really have a reason to access mUserList() or mUserCount directly. In many situations, however, you need to write class code where access to the member variables of the class is important. Recall from Chapter 3, "Thinking About Programs," that class member variables represent the properties of the class. Collectively, the values of the properties define the current state of an object of the class.

Unlike the CPassword class from Chapter 15, this chapter presents an example in which you want to alter the values of the properties. This chapter shows you how to use property values to affect the state of a class object. As you work through the example presented in this chapter, I hope you feel the same sense of awe I did the first time I used these elements of Visual Basic .NET. There are some pretty bright people in Redmond who have made our lives a whole lot easier. To those people thanks!

As always, the starting point for any program is to grab a piece of paper and start scratching out a design.



Visual Basic .NET. Primer Plus
Visual Basic .NET Primer Plus
ISBN: 0672324857
EAN: 2147483647
Year: 2003
Pages: 238
Authors: Jack Purdum

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