Well done!
You have completed Understanding Subclassing and Inheritance in Python Quiz!
Quiz Question 1 of 5
Suppose you want the Developer
class to automatically increment the Employee.count
without explicitly redefining the __init__()
method in the subclass. Which approach would be most appropriate?
Choose the correct answer below:
-
A
Use a class variable in the
Developer
class that directly incrementsEmployee.count
. -
B
Leave the
__init__()
method undefined in theDeveloper
class and rely on the superclass’s implementation. -
C
Override the
__init__()
method inDeveloper
and manually incrementEmployee.count
. -
D
Use the
super()
function to call the superclass's__init__()
method and increment the count.