mardi 28 mai 2019

Are the "Prototype pattern" and the "Virtual constructor" the same patterns?

Does the Virtual constructor - implementing virtual function clone():

class X {
public:
     virtual X* clone() {
         return new X(*this);
     }
};

mean the same concept as the Prototype design pattern?

Aucun commentaire:

Enregistrer un commentaire