class Parent():
def print_last_name(self):
print('Roberts')
def print_skin_color(self):
print('White')
class Child(Parent):
def print_first_name(self):
print('Bucky')
# The child can also "override" a function that they inherited
def print_last_name(self):
print('Snitzleberg')
dad = Parent()
bucky = Child()
dad.print_last_name()
bucky.print_last_name()
网友评论