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

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"); } } }

Each Bridge class (object) will contain a different implementation of the required methods.