Пример #1
0
        public static void Main(string[] args)
        {
            IFactory   factory     = new UndergraduateFactory();
            Nightingle nightingle1 = factory.CreateNightingle();

            nightingle1.BuyRice();

            IFactory   factory2    = new VolunteerFactory();
            Nightingle nightingle2 = factory.CreateNightingle();

            nightingle2.BuyRice();
        }
        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();
        }
Пример #3
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();
        }