... Sorry, forgot subject first....

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?
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to