コード例 #1
0
        public static void Main()
        {
            RoundHole roundHole = new RoundHole();
            RoundPeg  roundPeg  = new RoundPeg();

            roundPeg.Radius = 7;

            SquarePeg squarePeg = new SquarePeg();

            squarePeg.Width = 9;
            PegAdapter pegAdapter = new PegAdapter(squarePeg);

            Console.WriteLine("Round Peg fits hole ? : " + roundHole.Fits(roundPeg));
            Console.WriteLine("Square Peg fits hole ? : " + roundHole.Fits(pegAdapter));

            Console.ReadLine();
        }
コード例 #2
0
 public PegAdapter(SquarePeg squarePeg)
 {
     _squarePeg = squarePeg;
     Radius     = GetRadius();
 }