void OnEnable() { Debug.Log ("------------------"); Debug.Log ("PROTOTYPE DESIGN PATTERN"); CloneFactory factory = new CloneFactory(); Sheep sally = new Sheep(); Sheep clonedSheep = (Sheep) factory.GetClone(sally); Debug.Log ("Sally: " + sally.ToString()); Debug.Log ("Clone of Sally: " + clonedSheep.ToString()); Debug.Log ("Sally Hash: " + sally.GetHashCode() + " - Cloned Sheep Hash: " + clonedSheep.GetHashCode()); }
void OnEnable() { Debug.Log("------------------"); Debug.Log("PROTOTYPE DESIGN PATTERN"); CloneFactory factory = new CloneFactory(); Sheep sally = new Sheep(); Sheep clonedSheep = (Sheep)factory.GetClone(sally); Debug.Log("Sally: " + sally.ToString()); Debug.Log("Clone of Sally: " + clonedSheep.ToString()); Debug.Log("Sally Hash: " + sally.GetHashCode() + " - Cloned Sheep Hash: " + clonedSheep.GetHashCode()); }
static void Main(string[] args) { CloneFactory animalMaker = new CloneFactory(); Sheep sally = new Sheep(); Sheep clonedSheep = (Sheep)animalMaker.GetClone(sally); Console.WriteLine(sally); Console.WriteLine(clonedSheep); Console.WriteLine($"Sally Hashcode {sally.GetHashCode()}"); Console.WriteLine($"Cloned Hashcode {clonedSheep.GetHashCode()}"); Console.ReadKey(); }