繼承修飾符(在類上)

繼承

指定基類(或父類)

Public Class Person
End Class

Public Class Customer
    Inherits Person

End Class

'One line notation
Public Class Student : Inherits Person
End Class

可能的物件:

Dim p As New Person
Dim c As New Customer
Dim s As New Student

NotInheritable

阻止程式設計師將該類用作基類。

Public NotInheritable Class Person
End Class

可能的物件:

Dim p As New Person

為 MustInherit

指定該類僅用作基類。 (摘要課)

Public MustInherit Class Person
End Class

Public Class Customer
    Inherits Person
End Class

可能的物件:

Dim c As New Customer