Inheritance: Adaptee, ITarget
コード例 #1
0
ファイル: Program.cs プロジェクト: qcjwq/DesignPatterns
        static void Main(string[] args)
        {
            Target target = new Adapter();
            target.Request();

            Console.ReadKey();
        }
コード例 #2
0
		public static void Main (string[] args)
		{
			Target t = new Adapter (); //instiante Target interface with Adapter
			Client c = new Client (t); //put the instance of Target interface into client
			c.MakeRequest ();          //now client can use method B from Adaptee through Adapter
			Adapter a = new Adapter (); // we can also directly put the instance of Adapter into client
			Client cc = new Client (a);
			cc.MakeRequest ();
		}
コード例 #3
0
ファイル: Program.cs プロジェクト: yonglehou/ToolRepository
 static void Main(string[] args)
 {
     ITarget t = new Adapter();
     t.Request("test");
 }