Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            Creator  c = new Creator();
            IProduct product;

            for (int i = 1; i <= 12; i++)
            {
                product = c.FactoryMethod(i);
                Console.WriteLine("Coffee Beans : " + product.ShipFrom());
            }
            Console.ReadKey();
        }
Ejemplo n.º 2
0
        static void Main(string[] args)
        {
            Creator    creator      = new Creator();
            CreditCard platinumCard = creator.FactoryMethod(CardsEnum.Platinum, 500, 10000);

            Console.WriteLine(platinumCard.CardType);
            Console.WriteLine(platinumCard.CreditLimit);
            Console.WriteLine(platinumCard.AnnualCharge);
            Console.WriteLine("-----------------------------");

            CreditCard moneyBackCard = creator.FactoryMethod(CardsEnum.MoneyBack, 500, 10000);

            Console.WriteLine(moneyBackCard.CardType);
            Console.WriteLine(moneyBackCard.CreditLimit);
            Console.WriteLine(moneyBackCard.AnnualCharge);
            Console.WriteLine("-----------------------------");

            CreditCard titaniumCard = creator.FactoryMethod(CardsEnum.Titanium, 500, 10000);

            Console.WriteLine(titaniumCard.CardType);
            Console.WriteLine(titaniumCard.CreditLimit);
            Console.WriteLine(titaniumCard.AnnualCharge);
            Console.ReadKey();
        }