Am 24.11.2011 16:56, schrieb Juha Manninen:
It says:
  unit1.pas(40,24) Error: Duplicate identifier "FreeObjects"

Why? If I change "FreeObjects" to "aFreeObjects" then it works. Again why?

You simply picked a bad example, because "TFPGObjectList" contains a property called "FreeObjects", thus mode ObjFPC will not allow you to declare a similar identifier again in this class.

Though it's inconsistent (and in my opinion a bug) that the duplicated declaration inside "TFPGObjectList" itself is not detected...

Note: if the property in "TFPGObjectList" would be moved before the constructor it should be detected as duplicate.

Is it even ok to derive classes from specialized classes like that?

Of course it is. In Delphi (and my generics branch) even the following is allowed:

{$mode delphi}

type
  TSomeDerivedList<T> = class(TFPGObjectList<T>)
    // ...
  end;

Regards,
Sven
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to