Exemplo n.º 1
0
        public CarrotCakePrototype GetPrototype1()
        {
            CarrotCakePrototype carrotCake = new CarrotCakePrototype();

            carrotCake.SecretIngredient = "carrot";
            return(carrotCake);
        }
Exemplo n.º 2
0
        public CarrotCakePrototype GetPrototype2(CarrotCakePrototype prototype1)
        {
            CarrotCakePrototype newCarrotCake = (CarrotCakePrototype)prototype1.Clone();

            return(newCarrotCake);

            // now we have two delicious carrot cakes, without having to
            // initialise / perform operations on two instances.
        }