fellow99说:!--StartFragment -- delphi的接口的意义是不是跟C++和Java的不同呢?
delphi的接口的意义是不是跟C++和Java的不同,怎么我这样不行的呢:
IInterface1 = interface
end;
IInterface2 = interface(IInterface1)
procedure method();
end;
TClass1 = class(TInterfacedObject, IInterface2)
......
end;
首先,编译器不承认TClass1是IInterface1的派生,一定要写成TClass1 = class(TInterfacedObject, IInterface2, IInterface1)才可以。
接着,这样子也不行:
function xxx(): IInterface2;
var
obj: TObject;