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

MustOverride 只能在屬性或程式宣告語句中使用。You 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 PropertyEnd 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 NotOverridable Overridable 在相同的宣告中,搭配、或來指定 SharedYou 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 StatementProperty Statement

Sub 陳述式Sub Statement

另請參閱See also