Strategy: (behavioral pattern)
Bridge: (structural pattern)
I hope my understanding of Strategy pattern is correct (I apologize for stupid example) with this C# code:
For the sake of simplicity, there's just different string returned from each strategy, but would represent totally unique algorithm for each fighting strategy in real world application.
Would the Bridge then be just abstracting Knife to Weapon base class (or IWeapon interface), and use its different implementations? Is this the point of Bridge?
Example of my Bridge understanding:
Is that it? Only extracting some interface (or create base class), and potentially have several implementors of this abstraction (IWeapon in this case), using some other abstraction (IFightingStrategy)? Or am I missing something here? Please, correct me using the same classes (if possible) in your example.
This post has been edited by lucky3: 25 April 2013 - 07:13 AM