Incorrect class names and missing forward declaration in C++ Mediator pattern example
Author: akkul143Created Aug 4, 2026Updated Aug 11, 2026
Description
The C++ Mediator pattern example uses inconsistent component class names.
The following classes are defined:
TextField
Button
LabelHowever, inside FormMediator and MediatorApp, the code uses:
TextFieldComponent
ButtonComponent
LabelComponentThese class names are not defined in the example.
The code should use the existing class names consistently:
TextField
Button
LabelFor example:
TextField* usernameField;
TextField* passwordField;
Button* loginButton;
Label* statusLabel;And:
TextField usernameField(&mediator);
TextField passwordField(&mediator);
Button loginButton(&mediator);
Label statusLabel(&mediator);Source: ashishps1/awesome-low-level-design