Skip to content

Instantly share code, notes, and snippets.

@norbinsh
Created September 19, 2018 20:02
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 norbinsh/f2876377794fada6b1f65337eb9235f7 to your computer and use it in GitHub Desktop.
Save norbinsh/f2876377794fada6b1f65337eb9235f7 to your computer and use it in GitHub Desktop.
class Room:
def __init__(self, has_door=True):
self.has_door = has_door
self.color = "White"
def show(self):
return("Here's your door: [-]")
a = Room()
print("A Room has a door?", a.has_door)
print(f"Door color is {a.color}")
print(a.show())
class BedRoom(Room):
def __init__(self, size="Huge"):
self.size = size
super().__init__()
def show(self):
return("Huge BedRoom door: [ - ]")
b = BedRoom()
print("BedRoom has a door?", b.has_door)
print(f"BedRoom door color is {b.color}")
print(f"BedRoom door size is {b.size}")
print(b.show())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment