If Any Web Resources Required.: Overloading
If Any Web Resources Required.: Overloading
If Any Web Resources Required.: Overloading
Practical No 20 & 21
Sub Main()
Dim res As New addition
Console.WriteLine("Overloaded Values of Class addition")
Console.WriteLine(res.add(10))
Console.WriteLine(res.add(35, 20))
Console.ReadLine()
End Sub
End Module
Output:
Overloaded Values of Class addition
10
55
Overriding:
Module Module1
Sub Main()
Dim obj As New child
Dim result As Integer
result = obj.add(10, 5)
Console.WriteLine("Overloaded Values of Class addition")
Console.WriteLine("Result =" & result)
Console.ReadLine()
End Sub
End Module
Public Class parent
Public Overridable Function add(ByVal i As Integer, ByVal j As Integer)
Return (i + j)
End Function
End Class
Output:
Result of Addition =30
Overloaded Values of Class addition
Result =15
Sub Main()
Dim obj As New EmpInfo
obj.ShowInfo()
Console.ReadLine()
End Sub
End Module
Public Class EmpPersonalDetails
Dim name As String
Dim address As String
Public Overridable Function ShowInfo()
Console.WriteLine("Employee Name" & name)
Console.WriteLine("Employee Address" & address)
End Function
End Class
Public Class EmpInfo
Inherits EmpPersonalDetails
Dim EmpId As Integer
Dim sallary As Integer
Dim JoinDate As Date
Overloads Function ShowInfo()
MyBase.ShowInfo()
Console.WriteLine("Employee ID" & EmpId)
Console.WriteLine("Employee Sallary" & sallary)
Console.WriteLine("Employee Joining Date" & JoinDate)
End Function
End Class
OUTPUT:
Employee Name
Employee Address
Employee ID0
Employee Sallary0
Employee Joining Date12:00:00 AM
XIV. Exercise
1. Implement a windows application for show string concatenation using overload
method
End Class
Output: