Einzelnen Beitrag anzeigen

Benutzerbild von implementation
implementation

Registriert seit: 5. Mai 2008
940 Beiträge
 
FreePascal / Lazarus
 
#6

AW: Generics in FPC 2.6: Compiler bricht einfach ab

  Alt 23. Feb 2013, 13:32
Delphi-Quellcode:
unit GenericTest;

{$MODE OBJFPC}

interface

uses
  Classes, SysUtils;

type

  { TFoo }

  generic TFoo<_T> = class
  private

  public
    procedure Test();
  end;



implementation



{ TFoo<_T> }

procedure TFoo.Test;
begin

end;

end.
Delphi-Quellcode:
unit Main;

{$MODE OBJFPC}
{$H+}

interface

uses
  Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls;

type

  { TForm1 }

  TForm1 = class(TForm)
    Button1: TButton;
    procedure Button1Click(Sender: TObject);
  private
    { private declarations }
  public
    { public declarations }
  end;

var
  Form1: TForm1;

implementation

uses
  GenericTest;

type
  TObjectFoo = specialize TFoo<TObject>;

{$R *.lfm}

{ TForm1 }

procedure TForm1.Button1Click(Sender: TObject);
var
  LVar: TObjectFoo;
begin

end;

end.
  Mit Zitat antworten Zitat