先记下一个接口与继承

      语言类学习笔记 2008-9-16 22:44

IOpenDoor = interface
  function Open: boolean
end;

THome = class(IOpenDoor)
  function Open
end;

TCar = class(IOpenDoor)
  function Open;
end;

var
  AOpen: IOpenDoor;
begin
  if xxx then AOpen := THome.Create
  else AOpen := TCar.Create;
  AOpen.Open();
end;

这个很像:

var
  a:Tstrings
begin
  a:=Tstringlist.create
end;

标签集:TAGS:
回复Comments() 点击Count()

回复Comments

{commentauthor}
{commentauthor}
{commenttime}
{commentnum}
{commentcontent}
作者:
{commentrecontent}