Creating Instances of a Class
By now you have had many examples demonstrating how to create instances of classes. However, this is the first chapter exclusively addressing the topic of classes, so let's take a moment to review the syntax for object creation.
Classes are referred to as reference types. Reference types, as opposed to value types, are created by declaring a variable and using the New keyword followed by the name of the class and parentheses:
Dim reference As New Class()
The example looks as if you are calling a procedure named Class. This is the form of constructing an object. In actuality, this code calls the constructor Sub New defined in class Class. If you have parameters to pass to your constructor, they are passed between ...
Get Visual Basic® .NET Unleashed 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.