unit Unit1; interface uses Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls; type IDemo=interface function A(i:Integer):Integer; end; type TDemo=class(TInterfacedObject,IDEmo) public function A(i:Integer):Integer; end; type TDemob=class(TInterfacedObject,IDEmo) public function A(i:Integer):Integer; end; type TForm1 = class(TForm) Button1: TButton; procedure Button1Click(Sender: TObject); private { Private declarations } public { Public declarations } end; var Form1: TForm1; implementation {$R *.dfm} { TDemo } function TDemo.A(i: Integer): Integer; begin ShowMessage('TDemo _'+inttostr(i)); end; { TDemob } function TDemob.A(i: Integer): Integer; begin ShowMessage('TDemob _'+inttostr(i)); end; procedure TForm1.Button1Click(Sender: TObject); var Demob:TDemob; Demo:TDemo; vIDemo:IDemo; begin Demo:=TDemo.Create; Demob:=TDemob.Create; vIDemo:=IDemo(Demo); vIDemo.A(1); vIDemo:=IDemo(Demob); vIDemo.A(2); end; end.