Inheritance
Inheritance
Parent Classes
Child Classes
class Parent():
def __init__(self, name, gender, dob, haircolor):
self.name = name
self.gender = gender
self.dob = dob
self.haircolor = haircolor
class Child(Parent):
def __init__(self,name, gender, dob, haircolor):
Parent.__init__(self, name, gender, dob, haircolor)
def main():
done = False
while not done:
print("Menu")
print("S - Start")
print("Q - Quit")
choice = input("Choice: ")
if choice == "S":
print("Start")
print("Explore My Family Tree")
mom = Parent("Momma", "Female", 1970, "brown")
dad = Parent("Daddy", "Male", 1969, "black")
me = Child("Sam", "Female", 2004, "brown")
elif choice == "Q":
print("Exiting Game!")
done = True
main()Last updated
Was this helpful?