[fpc-pascal] Virtual Constants

Adrian Veith adrian at vtim.de
Mon Mar 4 08:28:22 CET 2013


Am 01.03.2013 21:31, schrieb Daniel Gaspary:
> 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;
> _______________________________________________
> fpc-pascal maillist  -  fpc-pascal at lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal
currently I use a dirty hack to achieve something like this: I have a 
fixed naming scheme for the classname and encode the "virtual" const in 
the classname.



More information about the fpc-pascal mailing list