[fpc-pascal] bug or feature?
Elmar Haneke
elmar at haneke.de
Mon Feb 14 11:34:04 CET 2022
> This can't be right, can it?
>
> type
> TBird = class
> procedure Fly;
> end;
> TEagle = TBird; // alias
>
> procedure TEagle.Fly;
> begin
> end;
It does depend on what you expect an Type-Alias to be.
If you expect the compiler to generate an compatible class then your
example must not be compilable.
If you expect an alias die make the Typenames "TEagle" and "TBird"
equivalent it is no problem for the compiler which name you use at what
place.
In any case I would judge such code as "bad style" - programmers should
avoid doing so.
Elmar
More information about the fpc-pascal
mailing list