Cloneable Cloneable.cloneAnimal(Cloneable animal) { animal = new Sheep(); animal.setCloneName("Dolly"); return(animal); }
static void sheep() { Cloneable sheep = new Sheep(); Console.Write("\nCounting Sheep...\n\n"); CountUtil.count(sheep, 2); Console.Write("\n"); Cloneable sheepClone = sheep.cloneAnimal(sheep); CountUtil.count(sheepClone, 3); Console.Write("\n"); sheep.resetCount(); CountUtil.count(sheep, 1); }