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

Mattias Gaertner nc-gaertnma at netcologne.de
Sun Jun 12 13:16:29 CEST 2011


On Sun, 12 Jun 2011 12:25:58 +0200
Bart <bartjunk64 at gmail.com> wrote:

> 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?

A minor.
There is already a mantis item for this.

Mattias




More information about the Lazarus mailing list