Multiple inheritance in python

technical talkiess
0

 Multiple iNheritance :- 


class Employee:

    no_of_leaves = 9


    def __init__(self,name,age,salary):

        self.name = name

        self.age = age

        self.salary = salary


   

    def printEmployee(self):

        print(f"The name of the employee {self.name} and age is {self.age} and salary is {self.salary}")



class Person:

    no_of_holidays = 8


    def __init__(self,name,designation):

        self.name =name

        self.dsignation =designation



    def printPersondetails(self):

        return f"The name of the person is {self.name} and designation is {self.dsignation}"



# ise bolte hai multiple inheritance in the python

class itPerson(Person,Employee):

    pass


vishal =Employee("vishal",555,55555)

# print(vishal.printEmployee())


karan = itPerson("karan","Test")


print(karan.printPersondetails())

Post a Comment

0Comments

Thanks you for commenting your questions. I will see question and respond you.

Post a Comment (0)