Delegating to an Interface-Type Property If the delegate property is of an interface type, that interface, or an interface from which it derives, must occur in the
ancestor list of the class where the property is declared. The delegate property must return an object whose class
completely implements the interface specified by the implements directive, and which does so without method
resolution clauses. For example,
type
IMyInterface = interface
procedure P1;
procedure P2;
end;
TMyClass = class(TObject, IMyInterface)
FMyInterface: IMyInterface;
property MyInterface: IMyInterface read FMyInterface implements IMyInterface;
end;
var
MyClass: TMyClass;
MyInterface: IMyInterface;
begin
MyClass := TMyClass.Create;
197
MyClass.FMyInterface := ...// some object whose class implements IMyInterface
MyInterface := MyClass;
MyInterface.P1;
end;