Delphi Interfaces
Object Pascal (OP) keyword (interface) and data type added in Delphi 4.
More powerful extension of abstract base class design philosophy. Contract between code implementor and code user - specify what is available without binding user to a particular implementation.
Implement one or more interfaces in a class, directly, or by delegation. Interfaces can only contain methods or vanilla properties. Interfaces can be implemented or reimplemented (to override bahaviour), at any level in a class hierarchy.
Usage syntax similar to objects. eg. MyString := MyInterface.Text
OP keyword ‘as’ overloaded for interface variables, to retrieve other interfaces from the implementing object.eg. MyOtherString := (MyInterface as IMyOtherInterface).OtherText
All interfaces descend from IUnknown. TInterfacedObject implements IUnknown - use it as a base class for implementation.