extension class inherits from a method behavior of the base class, and then if you want to perform this behavior of the base class again, adding a reference to the base class before your own behavior, why add a parenthesis after super?
just write super.working () and report an error.
also, if you write the name of the base class here, Employee (). Working ()
will also report an error. You can only use super (). Working (), why.
the code is as follows:
class Employee:
def __init__(self,name,department,title,salary):
self.name = name
self.department = department
self.title = title
self.salary = salary
def __repr__(self):
return f":{self.name}"
def working(self):
print(f"{self.name}...")
class Developer (Employee):
def __init__(self,name,department,title,salary,skills):
Employee.__init__(self,name,department,title,salary)
self.skills = skills
def working(self):
super().working()
print("")
class Accountant (Employee):
def __init__(self,name,department,title,salary,certification):
Employee.__init__(self,name,department,title,salary)
self.certification = certification
if name ="_ _ main__":
d = Developer("tom","","","13000",["python","flask"])
print(d.name)
d.working()