[fpc-pascal] Virtual Constants
Joao Morais
jcmoraisjr at gmail.com
Sun Mar 3 15:13:21 CET 2013
On Fri, Mar 1, 2013 at 5:31 PM, Daniel Gaspary <dgaspary at gmail.com> wrote:
>
> Is possible to have a Class constant with different values in class
> descendants ?
Afaik no, but you can override class virtual methods which might give
you the correct value:
TA = class
protected
class function value: integer; virtual; abstract;
public
class function getvalue: integer;
end;
TB = class(TA)
protected
class function value: integer; override;
end;
TC = class(TA)
protected
class function value: integer; override;
end;
Joao Morais
More information about the fpc-pascal
mailing list