[fpc-pascal] how to simulate abstract properties
M.Santhoff at web.de
Sun Aug 16 04:37:52 CEST 2009
I'm searching for a way to have the compiler handle properties declared
inside an abstract base class as if they were methods.
With a declaration like this:
TBase = class
function getA: integer; virtual; abstract;
property A:integer read getA;
TDerived = class(TBase)
function getA: integer; override;
TDerived2 = class(TBase)
the compiler runs and throws no error. Fine, but this way every class
derived from TBase is in danger of calling an abstract method at
runtime. If at an instance of class TDerived2 the property A is read a
runtime error 211 is thrown.
What I want is to ensure not forgetting to override any method. The
compiler should stop on error when this happens.
How can this be done?
(I know the compiler does emit a warning, but switching to "stop on
warning" is o option for me.)
Marc Santhoff <M.Santhoff at web.de>
More information about the fpc-pascal