Ayuda con error ObjectLists<T> delphi 2010
Buenas, me disculpo si este tema no encaja aqui porque soy nuevo en este foro y tengo poco conocimiento con respecto a algunas cosas, mi problema es el siguiente, quiero utilizar un TObjectList para manipular objetos genéricos de otro unit algo similiar a un linkedList de c# o java, sin embargo he tenido dificultades debido a que me da este error " [DCC Error] BPrincipal.pas(64): E2003 Undeclared identifier: 'TObjectList<>' ", en cierta parte entiendo el error pero no tengo la mas minima idea de como solucionarlo, mi codigo esta en un form y es el siguiente, (agradeceria si me pudieran ayudar, el codigo es una modificacion del ejemplo que viene con la documentacion del rad studio 2010)
unit BPrincipal;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
type
{ Declaro el nuevo tipo de objeto generico }
TNewObject = class
private
a_nombre: String;
a_codigo: integer;
public
constructor Create( nombre: String; codigo : integer);
destructor Destroy(); override;
property nombre : string read a_nombre write a_nombre;
property codigo : integer read a_codigo write a_codigo;
end;
{ TNewObject }
var
Form1: TForm1;
implementation
constructor TNewObject.Create( nombre: String; codigo : integer);
begin
a_nombre := nombre;
a_codigo := codigo;
end;
destructor TNewObject.Destroy;
begin
{ muestra un mensaje anunciando que el objeto tal morira }
MessageDlg('el objeto con nombre "' + a_nombre + '" murio!', mtInformation, [mbOK], 0);
inherited;
end;
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var
List: TObjectList<TNewObject>;
Obj: TNewObject;
begin
{ Create a new List. }
List := TObjectList<TNewObject>.Create();
{ Set the OwnsObjects to true--the List will free them automatically. }
List.OwnsObjects := true;
{ Add some items to the List. }
List.Add(TNewObject.Create('One'));
List.Add(TNewObject.Create('Two'));
{ Add a new item, but keep the reference. }
Obj := TNewObject.Create('Three');
List.Add(Obj);
{
Remove an instance of the TNewObject class. Destructor
should be called, because you have set the OwnsObjects
to true.
}
List.Delete(0);
List.Extract(Obj);
{ Destroy the List completely--more message boxes will be shown. }
List.Free;
end;
end.
En donde esta de rojo y subrayado empiezan los errores, hay mas pero todos desencadenado por el 1 error, no se si sera que me falta algun uses o algo por el estilo, estoy seguro que debe ser algo mínimo pero no le puedo llegar a lo que sera, les agradezco sus opiniones.
|