Esempio n. 1
0
        public IFootball Clone()
        {
            Football clone = (Football)this.MemberwiseClone();

            clone._id++;
            Console.WriteLine($"Ball's delivery number {clone._id}. Football {(clone._isInflated ? "is inflated" : "is not inflated")}");

            return(clone);
        }
        public void RunClientCode()
        {
            Console.WriteLine("***** START PROTOTYPE *****");

            Football[] footballs = new Football[3];

            footballs[0] = new Football(false);
            footballs[1] = footballs[0].Clone() as Football;

            footballs[1].InflateFootball();

            footballs[2] = footballs[1].Clone() as Football;

            foreach (Football football in footballs)
            {
                football.InflateFootball();
            }

            Console.WriteLine("***** END PROTOTYPE *****");
            Console.WriteLine();
        }