Two Way Adapter Pattern Code Review
Define the Seacraft Interface and Handler Object
Code Review
- Two-Way Adapter Pattern Code Review: Define the AirCraft Interface and Handler Object
- Two-Way Adapter Pattern Code Review: Define the Seacraft Interface and Handler Object
- Two-Way Adapter Pattern Code Review: Define the Seabird Two-Way Adapter Object
- Two-Way Adapter Pattern Code Review: Use the Two-Way Adapter Pattern
Code Walkthrough
Define the ISeacraft interface to be used as the target interface, which represents the second adapter.
interface IAircraft
{
bool Airbourne { get; }
void TakeOff();
int Height { get; }
}
The Seacraft 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; } }
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; } }
Printer Friendly Version
Add to Favourites
DotNet Kicks
Digg
del.icio.us
Live Favourites
ma.gnolia
reddit
Slashdot
Technorati
Yahoo!