Inheritance
class Employee:
def __init__(self, name, salary):
self.name = name
self.salary = salary
def get_details(self):
print("from Employee ->")
return "Name: " + self.name + ", Salary: " + str(self.salary)
class Clerk(Employee):
print("from clerk->")
pass
class SoftwareEngineer(Employee):
def __init__(self, name, salary, programming_languages):
super().__init__(name, salary)
self.programming_languages = programming_languages
def get_details(self):
print("from software engineer->")
return super().get_details() + ", Programming Languages: " + self.programming_languages
class TeamLeader(SoftwareEngineer):
def __init__(self, name, salary, programming_languages, team_size):
super().__init__(name, salary, programming_languages)
self.team_size = team_size
def get_details(self):
print("Team leader->")
return super().get_details() + ", Team Size: " + str(self.team_size)
e1 = Employee("John", 5000)
print(e1.get_details())
c1 = Clerk("Jane", 3000)
print(c1.get_details())
se1 = SoftwareEngineer("Mike", 6000, "Python, Java")
print(se1.get_details())
tl1 = TeamLeader("Steve", 8000, "Python, Java, C++", 10)
print(tl1.get_details())