Program:
#1st Classclass Person():
def __init__(self,name,age,dob):
self.name=name
self.age=age
self.dob=dob
#2nd Class
class Employee():
def __init__(self, salary,dept):
self.salary=salary
self.dept=dept
# inheritance from both the Above class
class Leader(Person, Employee):
def __init__(self,name,age,dob,salary,dept,dept_post):
self.dept_post=dept_post
Person.__init__(self,name,age,dob)
Employee.__init__(self,salary,dept)
def get_info(self):
print(f"Name: {self.name}\nAge: {self.age}\nDOB: {self.dob}\nSalary: {self.salary} $")
print(f"Department: {self.dept}\nDept.Post: {self.dept_post}")
#Object Created
obj=Leader('Manish Agrawal',22,'25 Dec. 1998',56565,'R&D',"Manager")
print("\t\t>>> Uncoders Pvt. Ltd >>>")
obj.get_info()
Expected O/P:
>>> Uncoders Pvt. Ltd >>>
Name: Manish Agrawal
Age: 22
DOB: 25 Dec. 1998
Salary: 56565 $
Department: R&D
Dept.Post: Manager
0 Comments
Post a Comment