1 year ago

#352525

test-img

Edijs Kolesnikovičs

Why no warning when dynamic abstract is used?

I have:

unit AnimalClasses;

interface

type
  TAnimal = class
  public
    function GetName: string; virtual; abstract;
  end;

type
  TCat = class(TAnimal)
  end;

function AnimalFactory(const ANumber: integer): TAnimal;

implementation

function AnimalFactory(const ANumber: integer): TAnimal;
begin
  Result := TCat.Create;
end;

end.

and the compiler gives me the warning:

[dcc32 Error] AnimalClasses.pas(29): E1020 Constructing instance of 'TCat' containing abstract method 'TAnimal.GetName'

Sadly, when I use dynamic; abstract; the compiler does not issue me a warning and then I get a runtime error. Why?

delphi

dynamic

compiler-warnings

abstract

0 Answers

Your Answer

Accepted video resources