Class Person
Public Name As String
Public Age As Integer
Public Sub New(ByVal Name As String, ByVal Age As Integer)
Me.Name = Name
Me.Age = Age
End Sub
End Class
Class Player
Inherits Person
Public Sport As String
Public Team As String
Public Sub New(ByVal Name As String, ByVal Age As Integer, _
ByVal Sport As String, ByVal Team As String)
MyBase.New(Name, Age)
Me.Team = Team
Me.Sport = Sport
End Sub
End Class
Class BasketPlayer
Inherits Player
Public PointsPerGame As Double
Public Rebounds As Double
Public Sub New(ByVal Name As String, ByVal Age As Integer, _
ByVal Sport As String, ByVal Team As String, ByVal Points As Double, ByVal Rebounds As Double)
MyBase.New(Name, Age, Sport, Team)
Me.PointsPerGame = Points
Me.Rebounds = Rebounds
End Sub
Public Sub Show()
Console.WriteLine("Player: " & Name)
Console.WriteLine("Age: " & Age)
Console.WriteLine("Sport: " & Sport)
Console.WriteLine("Team: " & Team)
Console.WriteLine("Points: " & PointsPerGame)
Console.WriteLine("Rebounds: " & Rebounds)
End Sub
End Class
Module Module1
Sub Main()
Dim K As New BasketPlayer("AA", 12, "Basketball", "Team", 25.5, 6.3)
K.Show()
End Sub
End Module
|