[Overview][Constants][Types][Classes][Procedures and functions][Variables][Index] | Reference for unit 'System' (#rtl)

# TAggregatedObject

[Properties (by Name)] [Methods (by Name)] [Events (by Name)]

Aggregated object

## Declaration

Source position: objpash.inc line 316

`type TAggregatedObject = class(TObject)`
`public`
`constructor Create();` |  | Create a new instance of TAggregatedObject
`property Controller: IUnknown; [r]` |  | Controlling instance
`end;`

## Inheritance

`TAggregatedObject` |  | Aggregated object
`TObject` |  | Base class of all classes.

## 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.

## See also

Create |  | Create a new instance of TAggregatedObject
Controller |  | Controlling instance

Documentation generated on: May 14 2021