Two Way Adapter Pattern Code Review
Define the Seabird Two Way Adapter 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
The SeabirdAdapter class (object) represents the two-way adapter class, and is the common interface between the two adapted classes (objects).
class SeabirdAdapter : Seacraft, IAircraft
{
public Int32 Height { get; private set; }
public void TakeOff() { while (!this.Airbourne) { this.IncreaseRevs(); } }
public Boolean Airbourne { get { return (this.Height > 50); } }
public override void IncreaseRevs() { base.IncreaseRevs();
if (this.Speed > 40) { this.Height += 100; } } }
public void TakeOff() { while (!this.Airbourne) { this.IncreaseRevs(); } }
public Boolean Airbourne { get { return (this.Height > 50); } }
public override void IncreaseRevs() { base.IncreaseRevs();
if (this.Speed > 40) { this.Height += 100; } } }
Printer Friendly Version
Add to Favourites
DotNet Kicks
Digg
del.icio.us
Live Favourites
ma.gnolia
reddit
Slashdot
Technorati
Yahoo!