design-patterns-cpp
design-patterns-cpp copied to clipboard
missing fields in the Prototype Pattern
Hi Jakub,
It might be late, but helpful to anybody. The Prototype Pattern example seems like a factory pattern, at least I think so. Please, correct me if I am wrong.
The class that implements the Prototype Pattern should create an exact copy of the class instance, thus it means that you should not create a new empty object not including data members of the class and need a copy constructor. In your example, there is no data member in the class, but it might be meaningful if you put some there, in particular private or protected ones.
Regards