Last active
December 20, 2015 11:49
-
-
Save yemrekeskin/6126157 to your computer and use it in GitHub Desktop.
Strategy Design Pattern implementation - Payment types (Accounting and Transfer)
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
public interface ITransferOperation | |
{ | |
bool DoAccounting(); | |
void Transfer(); | |
} | |
public class ForeignPayment | |
:ITransferOperation | |
{ | |
public bool DoAccounting() | |
{ | |
throw new NotImplementedException(); | |
} | |
public void Transfer() | |
{ | |
throw new NotImplementedException(); | |
} | |
} | |
public class DomesticPayment | |
:ITransferOperation | |
{ | |
public bool DoAccounting() | |
{ | |
throw new NotImplementedException(); | |
} | |
public void Transfer() | |
{ | |
throw new NotImplementedException(); | |
} | |
} | |
public class SepaPayment | |
: ITransferOperation | |
{ | |
public bool DoAccounting() | |
{ | |
throw new NotImplementedException(); | |
} | |
public void Transfer() | |
{ | |
throw new NotImplementedException(); | |
} | |
} | |
public class Payment | |
{ | |
private readonly ITransferOperation _transfer; | |
public Payment (ITransferOperation transfer) | |
{ | |
this._transfer = transfer; | |
} | |
public bool DoAccounting() | |
{ | |
this._transfer.DoAccounting(); | |
return default(bool); | |
} | |
public void Transfer() | |
{ | |
this._transfer.Transfer(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment