Le Mar 31, 2008 à 3:20 PM, ik a écrit :
After you define the generic you must first create a type for it:
type
TMyMcollection = specialize TMCollection<String>;
Sorry but it did not change anything.
Additionally, I would prefer to define the specialization in another
unit.
And use the TMyMcollection.
It seems like hard work, but it is much better then the way it look on
a bad C++ and Java code :)
:)
Ido
On Mon, Mar 31, 2008 at 4:00 PM, Damien Gerard
<[EMAIL PROTECTED]> wrote:
I would like to make a generic class, like this :
{$mode objfpc}
generic TMCollection<_T> = class(TObject)
private
FDefaultItem: _T; // line 35
public
constructor Create;
destructor Destroy;override;
[...]
end;
But I have got the following :
commons.pas(35,21) Error: Identifier not found "_T"
commons.pas(35,21) Error: Error in type definition
commons.pas(39,34) Error: Identifier not found "_T"
commons.pas(44,84) Error: Identifier not found "_T"
According to the documentation, I should use `var private`, but I
have
got :
Compiling ./commons.pas
commons.pas(33,3) Error: VAR and TYPE are allowed only in generics
commons.pas(35,21) Error: Identifier not found "_T"
Could someone tell me where I am wrong ?
Thanks !
--
Damien Gerard
[EMAIL PROTECTED]
"Intelligence is 10 million rules."
-- Douglas Lenat
_______________________________________________
fpc-pascal maillist - fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
--
http://ik.homelinux.org/
_______________________________________________
fpc-pascal maillist - fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
--
Damien Gerard
[EMAIL PROTECTED]
"Intelligence is 10 million rules."
-- Douglas Lenat
_______________________________________________
fpc-pascal maillist - fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal