Pluggable Adapter Pattern Code Review
Use the Pluggable Adapter Pattern
Code Review
- Pluggable Adapter Pattern Code Review: Define the Adapter Class, Adaptee and Target Classes
- Pluggable Adapter Pattern Code Review: Use the Pluggable Adapter Pattern
Code Walkthrough
The Program class creates two instances of the Adapter class (object), passing a different pluggable adapter to each Adapter instance.
class Program
{
static void Main(string[] args)
{
Adapter adapter1 = new Adapter(new Adaptee());
Console.WriteLine(adapter1.Request(5));
Adapter adapter2 = new Adapter(new Target()); Console.WriteLine(adapter2.Request(5));
Console.Read(); } }
Adapter adapter2 = new Adapter(new Target()); Console.WriteLine(adapter2.Request(5));
Console.Read(); } }
Printer Friendly Version
Add to Favourites
DotNet Kicks
Digg
del.icio.us
Live Favourites
ma.gnolia
reddit
Slashdot
Technorati
Yahoo!