7.5. Shared Methods and Class Math

As you know, every class provides methods that perform common tasks on objects of the class. For example, to display the grade information in a GradeBook object, we defined and called method DisplayGradeReport (Section 6.5). Recall that when we call GradeBook methods such as DisplayGradeReport, we first need to create a GradeBook object.

Although most methods of a class execute in response to method calls on specific objects, this is not always the case. Sometimes a method performs a task that does not depend on the contents of an object. Such a method applies to the class in which it is declared and is known as a Shared method or a class method. It is not uncommon for a class to contain a group of convenient ...

Get Visual Basic 2005 for Programmers: Deitel Developer Series, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.