Constructors

A constructor is a method you invoke to create a new instance of a class that is represented by the New keyword in Visual Basic. For example, if you have the following Contact class

image

you can then create a new instance of the Contact class as follows:

image

All the three preceding syntaxes are enabled, so you can use the one you prefer. (I use the second one for better readability.) In other words, creating an instance means giving life to a new copy of the object so that you can use it for your purposes, such as storing data or performing ...

Get Visual Basic® 2010 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.