TInterfacedObject = class(TObject, IInterface)
class PASCALIMPLEMENTATION TInterfacedObject : public TObject
TInterfacedObject is a thread-safe base class for Object Pascal classes that support interfaces. TInterfacedObject provides basic reference-counting functionality that makes its descendent classes useful in both Object Pascal and C++ code.
Note: In Object Pascal, variables declared to be of type TInterfacedObject have dynamic binding, meaning that an instance of a descendent class can be assigned to that variable at run time. This is because TInterfacedObject implements QueryInterface, which is called at run time to query whether the instantiated object supports the requested interface. If it does, the descendent object is successfully assigned to the variable. Without QueryInterface support, such an assignment would produce a compile-time error.
In Object Pascal, a descendant of TInterfacedObject does not have a class factory or a CLSID. Thus it cannot be instantiated except by calling a constructor.
TInterfacedObject does not implement the methods of the C++ version of IUnknown or IInterface. This is not a problem when using C++ wrappers for TInterfacedObject descendants that are written in Object Pascal. However, if you are creating C++ descendants of TInterfacedObject, you must provide your own implementation of IUnknown. For information on how to do this, see Creating classes that support IUnknown (supplied with C++ products only).