Wednesday, October 27, 2010

Constructor

The constructor of a class is implemented as a subroutine. The constructor may or may not require parameters. A subroutine cannot return a value.


Code eg 1: Constructor with no paramters

Public Sub New()
' Code does something...
End Sub

Code eg 2: Constructor with paramters
Public Sub New(NumberOfPoints As Integer, UserName As String)
' Code does something with parameters...
End Sub

No comments:

Post a Comment