Design Pattern for Base-Class/Subclass Data Sharing in Command-Execution-Result Workflow

I’m working on an operation flow of "parse command – execute action – return result". Both the command parsing and result returning inherit from a base class, while the action execution is overridden by specific Workers. During the action execution, I need to replace part of the result data into the return data cluster. However, when using this setup, I noticed that the methods inherited from the base class only access the private data of the base class. How can I implement a mechanism for the base class and subclasses to share data content? Since I feel that global variables or FGVs (Functional Global Variables) would disrupt the clean calling relationship of the Workers, I’d like to ask if you have any other good solutions.

1
6 replies