Пример #1
0
        static void Main()
        {
            Console.WriteLine("***Prototype Pattern Demo***\n");
            BasicCar nanoBase = new Nano("Green Nano")
            {
                Price = 10000
            };
            BasicCar fordBase = new Ford("Ford Yellow")
            {
                Price = 5000
            };

            BasicCar bc1 = nanoBase.Clone();

            bc1.Price = nanoBase.Price + BasicCar.SetPrice();
            Console.WriteLine("Car is: {0}, and it's price is Rs. {1}", bc1.ModelName, bc1.Price);

            bc1       = fordBase.Clone();
            bc1.Price = fordBase.Price + BasicCar.SetPrice();
            Console.WriteLine("Car is: {0}, and it's price is Rs. {1}", bc1.ModelName, bc1.Price);

            Console.ReadLine();
        }