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 Pl;

procedure P2;


TMyClass = class(TObject, IMyInterface) FMyInterface: IMyInterface;

property MyInterface: IMyInterface read FMyInterface implements IMyInterface; end; var

MyClass: TMyClass; MyInterface: IMyInterface; begin

MyClass := TMyClass.Create;

MyClass.FMyInterface := ...// some object whose class implements IMyInterface MyInterface := MyClass; MyInterface.Pl; end;

Project Management Made Easy

Project Management Made Easy

What you need to know about… Project Management Made Easy! Project management consists of more than just a large building project and can encompass small projects as well. No matter what the size of your project, you need to have some sort of project management. How you manage your project has everything to do with its outcome.

Get My Free Ebook

Post a comment