design-patterns-cpp icon indicating copy to clipboard operation
design-patterns-cpp copied to clipboard

missing fields in the Prototype Pattern

Open borcun opened this issue 2 years ago • 1 comments

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

borcun avatar Aug 27 '23 09:08 borcun