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:

cpp
TextField
Button
Label

However, inside FormMediator and MediatorApp, the code uses:

cpp
TextFieldComponent
ButtonComponent
LabelComponent

These class names are not defined in the example.

The code should use the existing class names consistently:

cpp
TextField
Button
Label

For example:

cpp
TextField* usernameField;
TextField* passwordField;
Button* loginButton;
Label* statusLabel;

And:

cpp
TextField usernameField(&mediator);
TextField passwordField(&mediator);
Button loginButton(&mediator);
Label statusLabel(&mediator);

Source: ashishps1/awesome-low-level-design