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(); }
public PegAdapter(SquarePeg squarePeg) { _squarePeg = squarePeg; Radius = GetRadius(); }