是否有编译器选项可以让编译器在我实例化抽象类时给出错误而不是警告?
Foo = class
procedure Bar; virtual; abstract;
end;
var
f : Foo;
begin
f := Foo.Create; // <-- should give me a compile time error
end;
是否有编译器选项可以让编译器在我实例化抽象类时给出错误而不是警告?
Foo = class
procedure Bar; virtual; abstract;
end;
var
f : Foo;
begin
f := Foo.Create; // <-- should give me a compile time error
end;
在Delphi 2010中(至少是在该版本中,可能还有早期版本但无法测试/验证):
Project -> Options
+ Delphi Compiler
> Hints and Warnings
+ Output Warnings:
Constructing instance containing abstract method: ___________
将此设置从"True"更改为"Error"