Created
September 19, 2018 20:02
-
-
Save norbinsh/f2876377794fada6b1f65337eb9235f7 to your computer and use it in GitHub Desktop.
This file contains 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 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