30.07.2013 Views

Visual Basic.NET How to Program (PDF)

Visual Basic.NET How to Program (PDF)

Visual Basic.NET How to Program (PDF)

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Chapter 8 Object-Based <strong>Program</strong>ming 341<br />

Purple box indicates<br />

a method<br />

Blue box preceded by a<br />

lock indicates a Private<br />

instance variable<br />

Fig. 8.20 Class View of Fig. 8.1 and Fig. 8.2.<br />

The second feature that <strong>Visual</strong> Studio provides is the Object Browser, which lists<br />

the Framework Class Library (FCL) classes available in <strong>Visual</strong> <strong>Basic</strong>. Developers use the<br />

Object Browser <strong>to</strong> learn about the functionality provided by a specific object. To open<br />

the Object Browser, right click any <strong>Visual</strong> <strong>Basic</strong> class or method in the code edi<strong>to</strong>r and<br />

select Go To Definition (Fig. 8.21). Figure 8.22 shows the Object Browser when the<br />

user selects keyword Object in the code edi<strong>to</strong>r. Note that the Object Browser lists all<br />

non-Private members provided by class Object in the Members of Object<br />

window—this window offers developers “instant access” <strong>to</strong> information regarding the services<br />

of various objects. Note also that the Object Browser lists in the Objects window<br />

all objects that <strong>Visual</strong> <strong>Basic</strong> provides.<br />

SUMMARY<br />

Every class in <strong>Visual</strong> <strong>Basic</strong> is a derived class of Object.<br />

Keywords Public and Private are member access modifiers.<br />

Instance variables, properties and methods that are declared with member access modifier Public<br />

are accessible wherever the program has a reference <strong>to</strong> an object of that class.<br />

Instance variables, properties and methods that are declared with member access modifier Private<br />

are accessible only <strong>to</strong> members of the class, such as other variables and methods.<br />

Every instance variable, property or method definition should be preceded by a member access<br />

modifier.<br />

Private methods often are called utility methods, or helper methods, because they can be called<br />

only by other methods of that class and are used <strong>to</strong> support the operation of those methods.<br />

The creation of Public data in a class is an uncommon and dangerous programming practice.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!