Skip to content

Instantly share code, notes, and snippets.

@yemrekeskin
Last active December 15, 2015 15:19
Show Gist options
  • Save yemrekeskin/5281327 to your computer and use it in GitHub Desktop.
Save yemrekeskin/5281327 to your computer and use it in GitHub Desktop.
example scenario for using bridge design pattern
/// <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