Overloading
How can be overload a method?? Please help meh out with this
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
AartiRank #2,383 · 594 reputationPosted Dec 25, 2011, 8:51 PM EST
Method Overloading: - Same Function name and return type having different Signature.
for example:
class MethodOverloading { public static int Plus(int number1, int number2) { return Plus(number1, number2, 0); } public static int Plus(int number1, int number2, int number3) { return number1 + number2 + number3; } }Satyapriya NayakRank #47 · 31.5K reputationPosted Dec 25, 2011, 8:52 PM EST
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
Thanks
Datta KharadRank #2,135 · 668 reputationPosted Dec 26, 2011, 1:59 AM EST
Refer this link...
http://www.c-sharpcorner.com/Forums/Thread/152484/overlaoding.aspx