From RAD Studio API Documentation
Jump to: navigation, search



TContainedObject = class(TAggregatedObject, IInterface)


class PASCALIMPLEMENTATION TContainedObject : public TAggregatedObject


Type Visibility Source Unit Parent
class public
System System


TContainedObject implements the IInterface interface as an inner object in an aggregate.

TContainedObject can be used as a base for classes that create inner, or contained, objects of an aggregate. In Delphi, use TComObject or its descendants to instantiate an outer object that supports aggregation.

The following implementation rules apply to aggregatable (inner or contained) objects, and are supported by TContainedObject:

  • When an object of its type is created, the creation succeeds only for a requested interface of type IInterface.
  • The IInterface methods _AddRef and _Release delegate to the controlling IInterface.
  • QueryInterface is implemented in TContainedObject only for interfaces implemented in the contained object.
  • The reference count on the inner object is incremented in the containing object.

Note: In Delphi, TContainedObject is used as a base class for a connection point that must be an inner object in an aggregate.

Note: An aggregated object is an object that is composed of several interfaced objects. Each object implements its own behavior and interfaces, but all of the objects share the same reference count, which is that of the controller object. In the container pattern, the controller is the container object.

See Also