O'Reilly logo

Visual Basic 2005 for Programmers: Deitel Developer Series, Second Edition by Harvey M. Deitel - Deitel & Associates, Inc., Paul J. Deitel - Deitel & Associates, Inc.

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

4.3. Declaring a Class with a Method and Instantiating an Object of a Class

We begin with an example that consists of class GradeBook (Fig. 4.1) and module GradeBookTest (Fig. 4.2). Class GradeBook (declared in file GradeBook.vb) displays a message on the screen (Fig. 4.2) welcoming the instructor to the grade-book application. Module GradeBookTest (declared in file GradeBookTest.vb) contains the Main method that instantiates (creates) and uses an object of class GradeBook. The class and module are placed in separate files for clarity, but it is possible to place them in the same file.

Figure 4.1. Class declaration with one method.
					1
					' Fig. 4.1: GradeBook.vb
					2
					' Class declaration with one method.
					3
					Public Class GradeBook
4
					' display a welcome ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required