以下示例显示了如何开始针对接口进行编码:
从
TMyObject = class
function Add(a, b: integer): integer;
end;
到
IInterface = interface
['{BFC7867C-6098-4744-9774-35E0A8FE1A1D}']
function Add(a, b: integer): integer;
end;
TMyObject = class (TInterfacedObject, IInterface
function Add(a, b: integer): integer;
end;
但是如果类有祖先,我该如何管理,比如 TMyClassDerivedDirectlyFromTObjectSoItsGotNothingInItAtAll ?
TMyObject = class(TMyClassDerivedDirectlyFromTObjectSoItsGotNothingInItAtAll)
function Add(a, b: integer): integer;
end;