Python Program to print employee details using multiple inheritance


In this program, you will learn how to print employee details using multiple inheritance in Python.


class Employee:

class Clerk:

class Manager(Employee, Clerk):

Example: How to print employee details using multiple inheritance in Python

class Employee:
    def input1(self):
        self.id = input("Enter your id:")


class Clerk:
    def input2(self):
        self.name = input("Enter your name:")
        self.sal = int(input("Enter your salary:"))


class Manager(Employee, Clerk):
    def view(self):
        super().input1()
        super().input2()

        print("\n\n=======Employee Details==========\n")

        print("Your id is:", self.id)
        print("Your name is:", self.name)
        print("Your salary is:", self.sal)


obj = Manager()
obj.view()

Output:

Enter your id:101
Enter your name:Xiith
Enter your salary:1000


=======Employee Details==========

Your id is: 101
Your name is: Xiith
Your salary is: 1000