Thursday 29 May 2014

program 14: function overloading (console)

program to demonstrate the concept of function overloading.    


-----------------------------------------code---------------------------------------------------------
Imports System.Console
Module Module1
    Sub Main()
        Dim a, b, c, sum As Integer
        Dim l, m, n, str As String
        WriteLine("Enter the value of a,b,c")
        a = ReadLine()
        b = ReadLine()
        c = ReadLine()
        WriteLine("Enter the value of l,m,n")
        l = ReadLine()
        m = ReadLine()
        n = ReadLine()
        sum = addition(a, b, c)
        str = addition(l, m, n)
        WriteLine("Addition of" & a & "," & b & "," & c & "is=" & sum)
        WriteLine("Addition of" & l & "," & m & "," & n & "is=" & str)
        ReadKey()
    End Sub

    Function addition(ByVal x As Integer, ByVal y As Integer, ByVal z As Integer) As Integer
        Return x + y + z
    End Function

    Function addition(ByVal x As String, ByVal y As String, ByVal z As String) As String
        Return x + y + z
    End Function
End Module

-----------------------------------------output----------------------------------------------------


umesh sohaliya
codestrew

No comments:

Post a Comment