LLD - Behavioral Design Patterns — Part 1
What will be the output of this Python code using Strategy pattern?
class StrategyA:
def execute(self):
print('Strategy A')
class StrategyB:
def execute(self):
print('Strategy B')
class Context:
def __init__(self, strategy):
self.strategy = strategy
def do_work(self):
self.strategy.execute()
c = Context(StrategyA())
c.strategy = StrategyB()
c.do_work()
