Design Pattern 11-Adapter

花阳辉
2023-12-01

using System;

namespace Pattern
{
 /// <summary>
 /// Summary description for Class1.
 /// </summary>
 public class adapter:Circle,draw
 {
  public adapter()
  {
   //
   // TODO: Add constructor logic here
   //
  }
  public void drawEqual()
  {
   System.Console.WriteLine("draw equal");
  }
 
 }
 public class Circle
 {
  public Circle()
  {
  }
  public void drawCircle()
  {
   System.Console.WriteLine("draw circle");
  }
 }
 public interface draw
 {
  void drawCircle();
  void drawEqual();
 }

}

   //适配器模式
//   adapter a=new adapter();
//   a.drawCircle();
//   a.drawEqual();

 类似资料: