June 2006
Intermediate to advanced
1344 pages
42h 52m
English
As mentioned in Section 4.5, when an object of class GradeBook (Fig. 4.7) is created, its instance variable courseNameValue is initialized to Nothing by default. What if you want to provide a course name when you create a GradeBook object? Each class you declare can provide a constructor that can be used to initialize an object of the class when the object is created. In fact, Visual Basic requires a constructor call for every object that is created. The New keyword calls the class’s constructor to perform the initialization. The constructor call is indicated by the class name followed by parentheses. For example, line 8 of Fig. 4.8 first uses New to create a GradeBook object. The lack of parentheses ...
Read now
Unlock full access