[fpc-devel] Language extension: absolute for classes

Micha Nelissen micha at neli.hopto.org
Sun Oct 1 20:43:21 CEST 2006


Michalis Kamburelis wrote:
> All you want is just to cover in class B identifier "Field" of class A.
> So you should make "Field" a dummy function in class A (that just
> returns a field value), and then you can redefine function name in
> descendant classes. See the example below. Within the scope of class B
> the "Field" function will return class G.

This is a smart hack, at best. It's abuse of function syntax IMHO (as if
they were fields). Second, you cannot assign to a function.

If the functions were inline, it could be as optimal, I agree; then you
have essentially localized the typecast to one place.

I just want to tell the compiler what I can guarantee, but what it
cannot automatically infer.

Thank you for the suggestion,

Micha



More information about the fpc-devel mailing list