Last active
December 15, 2015 15:19
-
-
Save yemrekeskin/5281327 to your computer and use it in GitHub Desktop.
example scenario for using bridge design pattern
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// <summary> | |
/// implementor | |
/// </summary> | |
public interface IFormatter | |
{ | |
} | |
/// <summary> | |
/// concrete implementor | |
/// </summary> | |
public class ExcelFormater | |
:IFormatter | |
{ | |
} | |
/// <summary> | |
/// concrete implementor | |
/// </summary> | |
public class OfficeFormater | |
:IFormatter | |
{ | |
} | |
/// <summary> | |
/// Abstraction | |
/// </summary> | |
public abstract class Reporting | |
{ | |
protected IFormatter formatter; | |
public Reporting(IFormatter formatter) | |
{ | |
this.formatter = formatter; | |
} | |
public abstract string OutList(); | |
} | |
/// <summary> | |
/// Redefined Abstraction | |
/// </summary> | |
class ProductReporting | |
:Reporting | |
{ | |
public ProductReporting(IFormatter formatter) | |
:base(formatter) | |
{ | |
} | |
public override string OutList() | |
{ | |
throw new NotImplementedException(); | |
} | |
} | |
/// <summary> | |
/// Redefined Abstraction | |
/// </summary> | |
public class SalesReporting | |
:Reporting | |
{ | |
public SalesReporting(IFormatter formatter) | |
:base(formatter) | |
{ | |
} | |
public override string OutList() | |
{ | |
throw new NotImplementedException(); | |
} | |
} | |
/// <summary> | |
/// Redefined Abstraction | |
/// </summary> | |
public class CashFlowReporting | |
:Reporting | |
{ | |
public CashFlowReporting(IFormatter formatter) | |
:base(formatter) | |
{ | |
} | |
public override string OutList() | |
{ | |
throw new NotImplementedException(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment