Пример #1
0
        private static void Main(string[] args)
        {
            Console.WriteLine("小明让小刚去酒店订餐");
            //定义执行者,小刚
            SomeG g = new SomeG();
            //定义命令,订餐
            Command com = new Hotel(g);
            //定义命令者,小明
            SomeM m = new SomeM(com);

            //执行命令
            m.Go();
            Console.ReadLine();
        }
Пример #2
0
 private static void Main(string[] args)
 {
     Console.WriteLine("小明让小刚去酒店订餐");
     //定义执行者,小刚
     SomeG g = new SomeG();
     //定义命令,订餐
     Command com = new Hotel(g);
     //定义命令者,小明
     SomeM m = new SomeM(com);
     //执行命令
     m.Go();
     Console.ReadLine();
 }