Skip to content

TAggregatedObject

Aggregated object.

Declaration

Source position: objpash.inc line 396

type

  TAggregatedObject = class(TObject)
  public
    constructor Create;
    property Controller: IUnknown; {r}
  end;

Description

TAggregatedObject implements an object whose lifetime is governed by an external object (or interface). It does not implement the IUnknown interface by itself, but delegates all methods to the controller object, as exposed in the Controller property. In effect, the reference count of the aggregated object is the same as that of it's controller, and additionally, all interfaces of the controller are exposed by the aggregated object.

Note that the aggregated object maintains a non-counted reference to the controller.

Aggregated objects should be used when using delegation to implement reference counted objects: the delegated interfaces can be implemented safely by TAggregatedObject descendents.

Properties

Member Visibility Description
Controller read only public Controlling instance.
See all Properties

Methods

Member Visibility Description
Create public Create a new instance of TAggregatedObject.
See all Methods

See also

Name Description
Create Create a new instance of TAggregatedObject.
Controller Controlling instance.