Bridge Pattern Code Review
Define the Pattern Interface and Handler Objects
Code Download
- Download Description:bridge pattern download
- .NET Framework:3.5
- .NET Language:C#
- Date Published:2009-07-01
- Download Size:8 KB
Code Review
- Bridge Pattern: Define the Pattern Interface and Handler Objects
- Bridge Pattern: Define the Portal Object
- Bridge Pattern: Use the Bridge Pattern
Code Walkthrough
Define the IPrinter interface to be used as the "blueprint" for the main Bridge classes.
class PrinterBridge
{
public interface IPrinter
{
String printTestPage();
}
public class InkJetPrinter : IPrinter { public string printTestPage() { return("This text has been printed on a Ink Jet Printer"); } } public class LaserPrinter : IPrinter { public string printTestPage() { return("This text has been printed on a Laser Printer"); } } public class DotMatrixPrinter : IPrinter { public string printTestPage() { return("This text has been printed on a Dot Matrix Printer"); } } }
public class InkJetPrinter : IPrinter { public string printTestPage() { return("This text has been printed on a Ink Jet Printer"); } } public class LaserPrinter : IPrinter { public string printTestPage() { return("This text has been printed on a Laser Printer"); } } public class DotMatrixPrinter : IPrinter { public string printTestPage() { return("This text has been printed on a Dot Matrix Printer"); } } }
Each Bridge class (object) will contain a different implementation of the required methods.
Printer Friendly Version
Add to Favourites
DotNet Kicks
Digg
del.icio.us
Live Favourites
ma.gnolia
reddit
Slashdot
Technorati
Yahoo!