Calling one constructor from the other

  • Thread starter Thread starter Shlomy Shivek
  • Start date Start date
S

Shlomy Shivek

With C# I am able to do something like that:

public ClassName() {some code here}
public ClassName(Parameters here):this() {some code here}

and when calling the parameters constructor it calls the default
constructor first and than continue to the parameter constructor code.

Is it possible to do the same thing with vb.net ??
 
In VB.NET you would do the following

Public Sub New()
'Some Code Here
End Sub

Public Sub New(ByVal parameters)
Me.New() 'Invokes The Default Constructor
'Some Code Here
End Sub


Hope That Helps.

Dan
 
Shlomy Shivek said:
public ClassName() {some code here}
public ClassName(Parameters here):this() {some code here}

and when calling the parameters constructor it calls the default
constructor first and than continue to the parameter constructor code.

Is it possible to do the same thing with vb.net ??

\\\
Public Sub New()
...
End Sub

Public Sub New(...)
Me.New()
...
End Sub
///
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top