Delphi updating tcomponent classes

6854933580_2c8b688306_z

An interface does not actually do anything - it only has a signature for interaction with other (implementing) classes or interfaces.The implementation of the methods (functions, procedures and property Get/Set methods) is done in the class that implements the interface.The Guid value that follows the interface keyword is used by the compiler to uniquely identify the interface.To generate a new GUID value, just press Ctrl Shift G in the Delphi IDE.Since TInterfaced Object is a TObject implementing IInterface.

However, interfaces are just an OOP feature of the language - they are not tied to COM specifically.

Interfaces can be defined and implemented in a Delphi application without touching COM at all.

To implement an interface you need to add the name of the interface to the class statement, as in: I have an (MDI) application where several forms can be displayed to the user at one time.

Here's why: TForm inherits from TComponent that already implements the IInterface for you!

When you want to implement an interface in a class that inherits from TObject - make sure your class inherits from TInterfaced Object instead.

When an interface defines a property it must define the get/set methods - interfaces cannot define variables.

You must have an account to comment. Please register or login here!