在VB.NET中,使用关键字 Inherits
来创建一个子类继承自一个父类
' 父类 Public Class Animal Public Property Name As String Public Sub New(name As String)'构造函数 Me.Name = name End Sub Public Overridable Sub Speak()'虚方法 Console.WriteLine("I am an animal.") End Sub End Class ' 子类继承自父类 Animal Public Class Dog Inherits Animal Public Sub New(name As String) MyBase.New(name) End Sub Public Overrides Sub Speak()'重写 Console.WriteLine("Woof! I am a dog named " & Me.Name) End Sub End Class
标签:VB,End,Sub,继承,Class,Animal,使用,Public,name From: https://www.cnblogs.com/zengxiaowei/p/18128142