A constructor is also a method and so it may also be overloaded.
eg. Constructor with an empty parameter list
End Class
eg. Constructor containing 2 parameters in the parameter list
End Class
Public Class User
Public Sub New()
' Code...
End Sub
' Code...
End Sub
End Class
eg. Constructor containing 2 parameters in the parameter list
Public Class User
Public Sub New(UserName As String, Password As String)
' Code...
End Sub
' Code...
End Sub
End Class
eg. Constructor containing 3 parameters in the parameter list
Public Class User
Public Sub New(UserName As String, Password As String, MembershipType As Membership)
' Code...
End Sub
' Code...
End Sub
End Class
No comments:
Post a Comment