Pacific Blue Software Logo

Download the file : pbs-delphi-interface-delegation-demo

PBS Delphi - Interface Delegation Demo


Version 1.0

Console demo of delegating an interface to a property in Delphi with the implements keyword.



A single-file Delphi console program showing how the implements keyword lets a host class delegate an interface to a property. The host claims IWorker without writing its methods; the work is done by whichever implementation the Worker property holds.

The demo obtains IWorker from the host, runs it, then swaps in a second implementation at runtime to show the caller does not change. It also shows how the delegate is reference counted while the host, held in a class-typed variable, is freed explicitly.


Read the article : Delegating an Interface to a Property in Delphi - the implements keyword

Free to use and modify


These links expire in one hour. Refresh the screen to extend the time.

Windows


Windows