unit uObjects;

interface

uses
  SysUtils, Variants, Classes;

type
  TObject1 = class(TObject)
  private
    FID : String;
  public
    function ToString : String;
  end;

  TObject2 = class(TObject)
  private
    FID : String;
  public
    function ToString : String;
  end;

  TObject3 = class(TObject)
  private
    FID : String;
  public
    function ToString : String;
  end;

  TObj1Factory = class(TObject)
  public
    function CreateObject1 : TObject1;
  end;

  TObj2Factory = class(TObject)
  public
    function CreateObject2 : TObject2;
  end;

  TObj3Factory = class(TObject)
  public
    function CreateObject3 : TObject3;
  end;

implementation

{ TObject1 }

function TObject1.ToString: String;
begin
  if (FID = '') then
    FID := 'TObject1 : ' + DateTimeToStr(Now);
  Result := FID;
end;

{ TObject2 }

function TObject2.ToString: String;
begin
  if (FID = '') then
    FID := 'TObject2 : ' + DateTimeToStr(Now);
  Result := FID;
end;

{ TObject3 }

function TObject3.ToString: String;
begin
  if (FID = '') then
    FID := 'TObject3 : ' + DateTimeToStr(Now);
  Result := FID;
end;

{ TObj1Factory }

function TObj1Factory.CreateObject1 : TObject1;
begin
  Result := TObject1.Create;
end;

{ TObj2Factory }

function TObj2Factory.CreateObject2 : TObject2;
begin
  Result := TObject2.Create;
end;

{ TObj3Factory }

function TObj3Factory.CreateObject3 : TObject3;
begin
  Result := TObject3.Create;
end;

end.
