Skip to content

Instantly share code, notes, and snippets.

@Sean-Bradley
Created August 17, 2020 18:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Sean-Bradley/f02ac543f130724f036986f231c1bfa5 to your computer and use it in GitHub Desktop.
Save Sean-Bradley/f02ac543f130724f036986f231c1bfa5 to your computer and use it in GitHub Desktop.
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