Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Delphi 2010 compiler warning about instantiation of abstract class should be a compiler error

Is there any compiler options that let the compiler give me an error instead of a warning when i instantiate an abstract class?

Foo = class
    procedure Bar; virtual; abstract;
end;

var
    f : Foo;
begin
    f := Foo.Create;  // <-- should give me a compile time error
end;
like image 690
hansmaad Avatar asked Jan 07 '11 09:01

hansmaad


1 Answers

In Delphi 2010 (at least, possibly earlier versions but cannot test/verify):

Project -> Options

  + Delphi Compiler

     > Hints and Warnings

         + Output Warnings:

              Constructing instance containing abstract method:  ___________

Change this setting from "True" to "Error"

like image 170
Deltics Avatar answered Oct 13 '22 12:10

Deltics