[fpc-pascal] Virtual Constants

Michael Van Canneyt michael at freepascal.org
Fri Mar 1 21:37:48 CET 2013



On Fri, 1 Mar 2013, Daniel Gaspary wrote:

> The idea is strange. But here it is:
>
> Is possible to have a Class constant with different values in class
> descendants ?
>
> Would be something like that:
>
> TA = class
> const
>        c1: integer; virtual;
>
>        class function GetC1: integer; //returns c1
> end;
>
> TB = class(TA)
> const
>        c1: integer = 1;
> end;
>
> TC = class(TA)
> const
>        c1: integer = 2;
> end;

Funny coincidence, I was looking for the same thing today :)

Michael.



More information about the fpc-pascal mailing list