コード例 #1
0
        protected override ICreditCard MakeProduct()
        {
            ICreditCard platinum = new PlatinumCreditCard();

            //Do something.
            return(platinum);
        }
コード例 #2
0
        public static ICreditCard GetCardInstance(int cardType)
        {
            ICreditCard cardDetails = null;

            if (cardType == 1)
            {
                cardDetails = new MoneyBackCreditCard();
            }
            else if (cardType == 2)
            {
                cardDetails = new TitaniumCreditCard();
            }
            else if (cardType == 3)
            {
                cardDetails = new PlatinumCreditCard();
            }
            return(cardDetails);
        }