Here in Russian Wikipedia link there is an example of C++ implementation of Command Design Pattern. As I understand from the implementation comparing with the UML class diagram I see that:
Also, as we can see from the diagram, Invoker aggregates Command. But in our case class Document does not aggregate the Command. Is it a mistake? Or is it a variation of Command pattern? How strict the UML diagram should be followed in general for designing a concrete pattern?
Namings for C++ example are not so good, I understand them as following:
Document
is a Receiver
, the object to apply the commands onReceiver
class acts as Invoker
in terms of provided UML diagram. main
method is a Client
You could take a look at Java example, it is more clean.