Imports System.Collections.Generic
public class Test
public Shared Sub Main
Dim emp_list As New EmployeeList
emp_list.Add(New Employee("G", "M"))
emp_list.Add("Z", "M")
End Sub
End class
Public Class Employee
Private m_FirstName As String
Private m_LastName As String
Public Sub New(ByVal first_name As String, ByVal last_name As String)
m_FirstName = first_name
m_LastName = last_name
End Sub
Public Overrides Function ToString() As String
Return m_FirstName & " " & m_LastName
End Function
End Class
Public Class EmployeeList
Inherits List(Of Employee)
Public Overloads Sub Add(ByVal first_name As String, ByVal last_name As String)
Dim emp As New Employee(first_name, last_name)
MyBase.Add(emp)
End Sub
End Class
|