Check Employee Validity || Hybrid Inheritance || Python
In this we are going to see a basic program to check employee validity using hybrid inheritance in Python Programming Language.


class Parent_class1:
    def __init__(self, name, id, salary):
        self.name = name
        self.id = id
        self.salary = salary

    def Employee_Details(self):
        return self.id, self.name, self.salary

    def Employee_check(self):
        if self.id > 500000:
            return " Valid Employee "
        else:
            return " Invalid Employee "


class Parent_class2:
    def msg(self):
        print("Employee check!!!")


class ChildClass(Parent_class1,Parent_class2):
    def sal(self):
        if self.salary > 200000:
            print("Employee is a manager")
        else:
            print("Employee is not a manager")


class last_class(ChildClass):
    def end(self):
        print(" END OF PROGRAM ")


Employee1 = last_class("Employee1", 198754, 150000)
Employee1.msg()
print(Employee1.Employee_Details(), Employee1.Employee_check())
Employee1.sal()
Employee2 = last_class("Employee2", 600445, 240000)
print(Employee2.Employee_Details(), Employee2.Employee_check())
Employee2.sal()

Employee1.end()

# Coded by Saahil

#ENJOY CODING


Post a Comment

FOR ANY DOUBTS AND ERRORS FEEL FREE TO ASK. YOUR DOUBTS WILL BE ADDRESSED ASAP

Previous Post Next Post