One of the most important part of prototype design pattern in OOP is that we don't create new object from scratch, we just clone them using clone() function from existing object. So is clone() function deep or shallow copy? if it's deep copy, than I understand everything, but if it's shallow one, it will be mess if two different objects(one created from another using prototype pattern) watch same state objects, than it means that these object aren't different at all(they are linked as they share same state objects). can anyone clarify me this situation?
Aucun commentaire:
Enregistrer un commentaire