예제 #1
0
        static void Main(string[] args)
        {
            BreadMaker breadMaker = null;

            breadMaker = BreadFactory.MakeBread(BreadType.BlackBread);
            breadMaker.GetBread();
            breadMaker = BreadFactory.MakeBread(BreadType.HoneyBread);
            breadMaker.GetBread();
            breadMaker = BreadFactory.MakeBread(BreadType.WhiteBread);
            breadMaker.GetBread();
            breadMaker = BreadFactory.MakeBread(BreadType.HoneyWhiteBread);
            breadMaker.GetBread();
        }
예제 #2
0
        public static BreadMaker MakeBread(BreadType breadType)
        {
            BreadMaker breadMaker = null;

            switch (breadType)
            {
            case BreadType.BlackBread:
                breadMaker = new BlackBread();
                break;

            case BreadType.HoneyBread:
                breadMaker = new HoneyBread();
                break;

            case BreadType.WhiteBread:
                breadMaker = new WhiteBread();
                break;

            case BreadType.HoneyWhiteBread:
                breadMaker = new HoneyWhiteBread();
                break;
            }
            return(breadMaker);
        }