Inheritance: Adaptee, ITarget
Exemple #1
0
        static void Main(string[] args)
        {
            Target target = new Adapter();
            target.Request();

            Console.ReadKey();
        }
		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 ();
		}
Exemple #3
0
 static void Main(string[] args)
 {
     ITarget t = new Adapter();
     t.Request("test");
 }