Implement the concept of overloading in console application.

CODE:

Public Class college

Public cname As String

Public roll As Integer

Public Overloads Sub getinfo(ByVal cname As String)

Console.WriteLine("college name:" & cname)

End Sub

Public Overloads Sub getinfo(ByVal roll As Integer)

Console.WriteLine("roll no:" & roll)

Console.ReadLine()

End Sub

End Class

Module Module1

Sub Main()

Dim c As New college

c.getinfo("thakur")

c.getinfo(27)

End Sub

End Module

No comments:

Post a Comment