MustOverride (Visual Basic)MustOverride (Visual Basic)

指定屬性或程序不這個類別中實作,而且必須覆寫衍生類別中才可以使用。Specifies that a property or procedure is not implemented in this class and must be overridden in a derived class before it can be used.

備註Remarks

您只能在屬性或程序宣告陳述式中使用 MustOverrideYou can use MustOverride only in a property or procedure declaration statement. 屬性或程序,指定MustOverride必須是類別的成員,且該類別必須標示MustInheritThe property or procedure that specifies MustOverride must be a member of a class, and the class must be marked MustInherit.

規則Rules

  • 不完整的宣告。Incomplete Declaration. 當您指定MustOverride,您未提供任何額外的數行程式碼的屬性或程序中,不甚至End FunctionEnd Property,或End Sub陳述式。When you specify MustOverride, you do not supply any additional lines of code for the property or procedure, not even the End Function, End Property, or End Sub statement.

  • 結合的修飾詞。Combined Modifiers. 您無法指定MustOverride連同NotOverridableOverridable,或Shared相同宣告中。You cannot specify MustOverride together with NotOverridable, Overridable, or Shared in the same declaration.

  • 遮蔽和覆寫。Shadowing and Overriding. 遮蔽和覆寫都會重新定義繼承的項目,但這兩種方法之間有顯著的差異。Both shadowing and overriding redefine an inherited element, but there are significant differences between the two approaches. 如需詳細資訊,請參閱 < Visual Basic 中的遮蔽功能For more information, see Shadowing in Visual Basic.

  • 替代的字詞。Alternate Terms. 不使用以外,覆寫中的項目有時稱為純虛擬項目。An element that cannot be used except in an override is sometimes called a pure virtual element.

MustOverride 修飾詞可用於以下內容:The MustOverride modifier can be used in these contexts:

Function 陳述式Function Statement

Property 陳述式Property Statement

Sub 陳述式Sub Statement

另請參閱See also