unit fmMain;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls;

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

var
  Form1: TForm1;

implementation

uses uClasses;

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
var
  aObj : TBase;
begin
  aObj := TDerived1.Create;
  aObj.VM2;
  aObj.Free;
end;

procedure TForm1.Button2Click(Sender: TObject);
var
  aFoo : TFoo;
  aFoo1 : TFoo;
begin
  aFoo := TFoo.Create;
  aFoo1 := TFoo.Create;
  try
{
    aFoo.Field := 10;
    aFoo.SetField(10);
    aFoo.SetStr('Test');
    ShowMessage(IntToStr(aFoo.Field));
    ShowMessage(aFoo.GetStr);
    aFoo.VM1;
}
    aFoo.VM1;
    aFoo1.VM1;

    ShowMessage(aFoo.MyName);
    ShowMessage(aFoo1.MyName);
  finally
    aFoo.Free;
    aFoo1.Free;
  end;
end;

end.
