Method Overloading is a means to having multiple methods with the same name, but which have differing parameter lists. Also called 'Polymorphism' - one name, many forms.
eg. getUserName function with empty parameter list
eg. getUserName function with a single string parameter called UserID
eg. getUserName function with a string parameter called UserID & a Date parameter called MembershipDate
Public Function getUserName() As String
' Code...
Return Value
End Function
' Code...
Return Value
End Function
eg. getUserName function with a single string parameter called UserID
Public Function getUserName(UserID as Integer) As String
' Code...
Return Value
End Function
' Code...
Return Value
End Function
eg. getUserName function with a string parameter called UserID & a Date parameter called MembershipDate
Public Function getUserName(UserID As Integer, MembershipDate As Date) As String
' Code...
Return Value
End Function
' Code...
Return Value
End Function
Further reading:
Create Overloaded Methods in VB.NET http://www.devx.com/dotnet/Article/9303
Method Overloading http://en.wikipedia.org/wiki/Method_overloading
No comments:
Post a Comment