lundi 10 juin 2019

Is `Clone()` in prototype pattern considered as a factory method?

Design Patterns by Gamma et al describes Prototype pattern:

enter image description here

Is Clone() considered as a factory method? (For comparison, an abstract factory is a collection of factory methods.)

Why are they (not) factory methods? For clarification, could you also provide the definition of a factory method?

An example of Clone() is

Door* Door::Clone  () const {
return new Door(*this);
}

There is a similar question In builder pattern, is method `buildpart()` factory methods?

Aucun commentaire:

Enregistrer un commentaire