Overloading in vb.net

Satyapriyanayak
Posted by Satyapriyanayak under VB.NET category on | Points: 40 | Views : 868
Overloading: - It is a process of using several procedures with the same name but having different signatures. The signature changes in number of parameters, type of parameter, and order of parameter. 

Program

Public Class Form1

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
raj()
raj(2)
raj(3, 3)
raj("ravi", 1)
raj(100, "rahul")
End Sub
Public Overloads Sub raj()
MsgBox("Hello Raj")
End Sub
Public Overloads Sub raj(ByVal x As Integer)
MsgBox(x * 5)
End Sub
Public Overloads Sub raj(ByVal x As Integer, ByVal y As Integer)
MsgBox(x + y)
End Sub
Public Overloads Sub raj(ByVal s As String, ByVal x As Integer)
MsgBox(s & ":has achieved rank" & x)
End Sub
Public Overloads Sub raj(ByVal x As Integer, ByVal s As String)
MsgBox(s & ":has secured" & x)
End Sub
End Class

Comments or Responses

Login to post response