Public Class Person Private m_name As String = "未設定" Public Property Name() As String Get Return m_name End Get Set(ByVal Value As String) m_name = Value End Set End Property End Class Public Class Child Inherits Person Private m_schoolName As String = "未設定" Public Property SchoolName() As String Get Return m_schoolName End Get Set(ByVal Value As String) m_schoolName = Value End Set End Property End Class Public Class Adult Inherits Person Private m_companyName As String = "未設定" Public Property CompanyName() As String Get Return m_companyName End Get Set(ByVal Value As String) m_companyName = Value End Set End Property End Class Public Class Persons _ Public persons(2) As Person Public Sub SetPersons(ByVal person1 As Person, ByVal person2 As Person, ByVal person3 As Person) persons(0) = person1 persons(1) = person2 persons(2) = person3 End Sub Public Sub Dump() For Each person As Person In persons System.Diagnostics.Trace.WriteLine(person.Name) If TypeOf person Is Child Then System.Diagnostics.Trace.WriteLine(CType(person, Child).SchoolName) Else System.Diagnostics.Trace.WriteLine(CType(person, Adult).CompanyName) End If Next End Sub End Class