[Lazarus] Codetools and virtual abstract methods (just nitpicking)

Bart bartjunk64 at gmail.com
Sun Jun 12 12:25:58 CEST 2011


Consider this code:

program test;

{$mode objfpc}{$H+}
{$R+}
uses sysutils, classes;

type

  { TCutomX }

  TCustomX = class (TStrings)
  protected
    procedure SomeProc; virtual; abstract;
  end;

  { TX }

  TX = class(TCustomX)
  protected
    procedure SomeProc; override; // Place cursor here
  end;


begin
end.

Now press Shift+Ctrl+C and voila codetools insert this code:

procedure TX.SomeProc;
begin
  inherited SomeProc;
end;

Which will (of course) not compile:
"test.lpr(32,21) Error: Abstract methods can't be called directly"

My fault, or a minor minor minor annoyance?

Bart




More information about the Lazarus mailing list