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 Function 、或语句提供任何代码行 End Property End SubWhen 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 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 StatementProperty Statement

Sub 语句Sub Statement

另请参阅See also