command_pattern::ConcreteCommand

class ConcreteCommand : public command_pattern::Command

ConcreteCommand binds a Receiver object with an action.

Public Functions

inline ConcreteCommand(std::shared_ptr<Receiver> receiver, const std::string &operation)

Constructor to initialize the command.

Parameters:
  • receiver – The receiver that performs the operation.

  • operation – The operation to be executed.

inline virtual void execute() const override

Execute the command by invoking the receiver’s action.

inline virtual void undo() const override

Undo the command by invoking the receiver’s reverseAction.