static void Main(string[] args)
        {
            //NewMethod();
            //NewMethod1();
            //NewMethod2();
            IFactory factory  = new UndergraduateFactory();
            IFactory factory2 = new VolunteerFactory();
            LeiFeng  stu      = factory.CreateLeiFeng();
            LeiFeng  vol      = factory2.CreateLeiFeng();

            stu.Sweep();
            vol.BuyRice();
            Console.ReadLine();
        }
Esempio n. 2
0
        static void Main(string[] args)
        {
            Console.ReadKey();
            UndergraduateFactory factory = new UndergraduateFactory();
            Leifeng student = factory.CreateLeiFeng();

            student.Sweep();
            student.Wash();
            student.BuyRice();

            Console.WriteLine("\n --------------------------");
            Console.ReadKey();

            IFactory factory2  = new VolunteerFactory();
            Leifeng  volunteer = factory2.CreateLeiFeng();

            volunteer.Sweep();
            volunteer.Wash();
            volunteer.BuyRice();

            Console.ReadKey();
        }