Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

i have this:

Public Class Customer

 

Private _ID As Integer

 

Public Sub New(ByVal id As Integer)

 

Me.ID = id

End Sub

 

Public Property ID() As Integer

Get

Return Me._ID

End Get

Set(ByVal Value As Integer)

Me._ID = Value

End Set

End Property

 

 

my question is,what the sub new is for?

its not a property or a method,so basically what it does???

(is it a built in something like "sub main" in modules?)

Posted
The Sub New is what is refered to as a constructor, it allows you to pass in information to a class at the point of instantiation.

 

You may find this useful.

 

got that! thanks!!!! :cool: ;)

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...