samedi 12 mars 2016

Prototype design pattern, what is being cloned?

I have been looking at the prototype pattern at this site: http://ift.tt/1V0xJqf

In sheep.java line 20 there is this piece of code:

    sheepObject = (Sheep) super.clone();

When you call super.close() aren't you copying the interface? What exactly is being cloned?

ps: You are probably going to have to click on the link to read the whole code (it's not that much) to understand what I mean.

Aucun commentaire:

Enregistrer un commentaire