Inherited Call Expressions

inherited can be used before an identifier to point to the base class of an instance, often used to access a member that this class also has. When used before a call the target method will be called as if it were non-virtual even if defined as virtual.

type
  BaseClass = class
  public
    method Test; virtual;
  end;

  SubClass = class(BaseClass)
  public
    method Test; override;
  end;

method BaseClass.Test;
begin
  Console.WriteLine('In BaseClass!');
end;

method SubClass.Test;
begin
  Console.WriteLine('In SubClass!');
  inherited Test; // calls BaseClass.Test.
end;
..
var x: BaseClass;
x := new SubClass;

x.Test; // Calls SubClass.Test.

See Also