composite_pattern::Composite

class Composite : public composite_pattern::Component

The Composite class represents the complex components that may have children.

A Composite object can have both Leaf and other Composite objects as children.

Public Functions

inline virtual void add(std::shared_ptr<Component> component) override

Adds a child component to the composite.

Parameters:

component – The child component to add.

inline virtual void remove(std::shared_ptr<Component> component) override

Removes a child component from the composite.

Parameters:

component – The child component to remove.

inline virtual bool isComposite() const override

Checks if the component is a composite.

Returns:

True, as this is a Composite.

inline virtual void operation() const override

Performs the operation for the composite and delegates to child components.