[lazarus] Possible compiler bug with derived classes?
Michael Van Canneyt
michael.vancanneyt at wisa.be
Thu Nov 4 04:23:54 EST 1999
On Thu, 4 Nov 1999, Chris Storah wrote:
> I am having problems when compiling a derived class (WinNT version).
> This is the code:
>
> TVer1 = class(TObject)
> protected
> rec: TObject;
> end;
>
> TVer2 = class(TVer1)
> protected
> rec: TObject; <=== duplicate identifier
> end;
>
>
> The error using ppc386 is 'Error: Duplicate identifier REC'.
This IS an error; if you declare such a thing in the protected
part, you should rename it. How is the compiler supposed to
know in a descendent class which one to take ? Any decision will
be necessarily an arbitrary one.
> Is this a known bug?
> If so, anyone know how to fix it without changing the identifier names
> (Delphi works with the above code).
Delphi has other strange quircks; Can you tell me WHICH rec it takes
when you refer to it ?
I agree that for the sake of compatibility, we should accept this, but it is
simply bad programming to do this, so this is not a priority.
Michael.
More information about the Lazarus
mailing list