Vererbung
Module Vererbung
Sub Main()
Dim a As New A()
Dim b As New B()
Dim c As A
c = New B()
Console.WriteLine(a.Message())
Console.WriteLine(b.Message())
Console.WriteLine(b.Message())
Console.ReadLine()
End Sub
End Module
Public Class A
Public Overridable Function Message() As String
Return "ich bin vom Typ A"
End Function
End Class
Class B
Inherits A
Public Overrides Function Message() As String
Return "ich bin vom Typ B"
End Function
End Class
|