Example #1
0
        static void Main(string[] args)
        {
            IFactory factory = new StudentFactory();
            LeiFeng  leiFeng = factory.CreateLeiFeng();

            leiFeng.Wash();
            leiFeng.Sweep();
            leiFeng.Cook();
        }
Example #2
0
        public static LeiFeng CreateLeiFeng(string type)
        {
            LeiFeng result = null;

            switch (type)
            {
            case "Undergraduate":
                result = new Undergraduate();
                break;

            case "Volunteer":
                result = new Volunteer();
                break;
            }

            return(result);
        }