[fpc-pascal] (no subject)

Juha Manninen juha.manninen62 at gmail.com
Thu Nov 24 16:56:43 CET 2011


I try to learn to use generics properly.
First, this is a class definition without generics:

  TMyDerived = class(TObjectList)
  private
    MyInt: integer;
  public
    constructor Create(FreeObjects: Boolean=True);
  end;

It works. Now I try to derive a class with generics:

  TMyGen = specialize TFPGObjectList<TControl>;

  TMyDerived = class(TMyGen)
  private
    MyInt: integer;
  public
    constructor Create(FreeObjects: Boolean=True);
  end;

It says:
 unit1.pas(40,24) Error: Duplicate identifier "FreeObjects"

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

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

Juha
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20111124/90593f40/attachment.html>


More information about the fpc-pascal mailing list