Created
August 17, 2020 18:10
-
-
Save Sean-Bradley/f02ac543f130724f036986f231c1bfa5 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
class UndecoratedObject: | |
@staticmethod | |
def get(): | |
return "UndecoratedObject" | |
class Decorate: | |
def __init__(self, undecorated): | |
self.undecorated = undecorated | |
def get(self): | |
return self.undecorated.get().replace("Undecorated", "Decorated") | |
# class DecorateWithANewMethod: | |
# def __init__(self, undecorated): | |
# self.undecorated = undecorated | |
# def get(self): | |
# return self.undecorated.get() | |
# def draw(self): | |
# print(self.undecorated.get()) | |
UNDECORATED = UndecoratedObject() | |
print(UNDECORATED.get()) | |
DECORATED = Decorate(UNDECORATED) | |
print(DECORATED.get()) | |
#DECORATEDWITHNEWMETHOD = DecorateWithANewMethod(DECORATED) | |
#DECORATEDWITHNEWMETHOD.draw() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment