Name

Override Directive

Syntax

Subroutine declaration; override;

Description

Use the override directive to declare a method that overrides a virtual or dynamic method declared in a base class. Refer to Chapter 2 for a discussion of virtual methods and polymorphism.

Example

type
  // Tile a bitmap.
  TTile = class(TGraphicControl)
  private
    fBitmap: TBitmap;
    procedure SetBitmap(NewBitmap: TBitmap);
    procedure BitmapChanged(Sender: TObject);
  protected
    procedure Paint; override;
  public
    constructor Create(Owner: TComponent); override;
    destructor Destroy; override;
  published
    property Align;
    property Bitmap: TBitmap read fBitmap write SetBitmap;
    property OnClick;
    // Many other properties are useful, but were omitted to save space.
    // See TControl for a full list.
  end;

See Also

Class Keyword, Dynamic Directive, Function Keyword, Inherited Keyword, Procedure Keyword, Reintroduce Directive, Virtual Directive

Get Delphi in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.