Functions OverLoading Example
Imports System Imports System.Collections.Generic Imports System.Linq Imports System.Text Namespace Program8 Class Program Private Shared Function sum(ByVal arg1 As Integer, ByVal arg2 As Integer) As Integer Return (arg1 + arg2) End Function Private Shared Function sum(ByVal arg1 As Integer, ByVal arg2 As Integer, ByVal arg3 As Integer) As Integer Return (arg1 + arg2 + arg3) End Function Private Shared Function sum(ByVal arg1 As Integer, ByVal arg2 As Integer, ByVal arg3 As Integer, ByVal arg4 As Single) As Single Return (arg1 + arg2 + arg3 + arg4) End Function Private Shared Sub Main(ByVal args As String()) Dim a, b, c As Integer Dim d As Single Console.WriteLine("Enter a,b values") a = Integer.Parse(Console.ReadLine()) b = Integer.Parse(Console.ReadLine()) Console.WriteLine("Sum of Two Numbers is " & sum(a, b)) Console.WriteLine("enter Third value") c = Integer.Parse(Console.ReadLine()) Console.WriteLine("The sum of above to and Third value " & sum(c, sum(a, b))) Console.WriteLine("The sum of above to and Third value " & sum(a, b, c)) Console.WriteLine("Enter any Real Value") d = Single.Parse(Console.ReadLine()) Console.WriteLine("The sum of above all numbers and Real value is " & sum(a, b, c, d)) End Sub End Class End Namespace
©Copyright 2016 All Rights Reserved LearnDotNetHome.com