In this we are going to see a basic program to check if a employee age is valid i.e more than 24 using single inheritance in Python Programming Language.
class Employee():
def __init__(self,age):
self.age = age
def checkAge(self):
if(self.age > 24):
print("Valid Age")
else:
print("Not Valid Age")
class InheritAge(Employee):
def __init__(self,age):
super().__init__(age)
print("Inherit Age Class")
i1 = InheritAge(26)
i2 = InheritAge(23)
i1.checkAge()
i2.checkAge()
# Coded By Dhiraj Shelke
#ENJOY CODING
Post a Comment
FOR ANY DOUBTS AND ERRORS FEEL FREE TO ASK. YOUR DOUBTS WILL BE ADDRESSED ASAP