1.Inheritance Example in VB.Net
Class A
Public _value As Integer
Public Sub Display()
Console.WriteLine(_value)
Console.ReadLine()
End Sub
End Class
Class B : Inherits A
Public Sub New(ByVal value As Integer)
MyBase._value = value
End Sub
End Class
Class C : Inherits A
Public Sub New(ByVal value As Integer)
MyBase._value = value * 2
End Sub
End Class
Module ClassDemo
Sub Main()
Dim b As B = New B(5)
b.Display()
Dim c As C = New C(5)
c.Display()
End Sub
End Module
0 comments
Post a Comment