Partilhar via


Overrides (Visual Basic)

Specifies that a property or procedure overrides an identically named property or procedure inherited from a base class.

Comentários

Rules

  • Declaration Context. You can use Overrides only in a property or procedure declaration statement.

  • Combined Modifiers. Não é possível especificar Overrides em conjunto com Shadows ou Shared na mesma declaração. Because an overriding element is implicitly overridable, you cannot combine Overridable with Overrides.

  • Matching Signatures. A assinatura desta declaração deve corresponder exatamente a assinatura da propriedade ou procedimento que ele substitui. This means the parameter lists must have the same number of parameters, in the same order, with the same data types.

    In addition to the signature, the overriding declaration must also exactly match the following:

    • The access level

    • The return type, if any

  • Generic Signatures. For a generic procedure, the signature includes the number of type parameters. Therefore, the overriding declaration must match the base class version in that respect as well.

  • Additional Matching. In addition to matching the signature of the base class version, this declaration must also match it in the following respects:

  • Sombreamento e substituição. Both shadowing and overriding redefine an inherited element, but there are significant differences between the two approaches. For more information, see Sombreamento em Visual Basic.

The Overrides modifier can be used in these contexts:

Function Statement

Property Statement

Sub Statement

Consulte também

Referência

MustOverride (Visual Basic)

NotOverridable (Visual Basic)

Overridable (Visual Basic)

Lista de tipos (Visual Basic)

Conceitos

Sombreamento em Visual Basic

Tipos genéricos no Visual Basic (Visual Basic)

Outros recursos

Palavras-chave (Visual Basic)