Two Way Adapter Pattern Code Review

Define the AirCraft Interface and Handler Object

Code Download

Code Review

Code Walkthrough

Define the IAircraft interface to be used as the target interface, which represents the first adapter.

interface IAircraft { bool Airbourne { get; } void TakeOff(); int Height { get; } }

The Aircraft class (object) represents a class to be adapted.

sealed class Aircraft : IAircraft { public Aircraft() { this.Height = 0; this.Airbourne = false; }
public bool Airbourne { get; private set; } public int Height { get; private set; }
public void TakeOff() { Console.WriteLine("Aircraft engine takeoff!"); this.Airbourne = true; this.Height = 200; } }