Skip to content

Instantly share code, notes, and snippets.

@Deep18-03
Created May 16, 2020 11:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Deep18-03/01f7544c00f58a7465ff8a6fcebf50b9 to your computer and use it in GitHub Desktop.
Save Deep18-03/01f7544c00f58a7465ff8a6fcebf50b9 to your computer and use it in GitHub Desktop.
class Employee:
no_of_leaves=5
def __init__(self,name,salary,role):
self.name=name
self.salary=salary
self.role=role
def printdetail(self):
return f"name is {self.name}.Salary is {self.salary}.Role is {self.role}"
class Programmer(Employee):
no_of_holiday=10
def __init__(self,name,salary,role,language):
self.name = name
self.salary = salary
self.role = role
self.language=language
def printdet(self):
return f"name is {self.name}.Salary is {self.salary}.Role is {self.role}.Lanaguage he knows are {self.language} "
carry=Employee("Carry",288,"Student") #Employee object
darry=Programmer("darry",39393,"Intern",["python"]) #Programmer Object
print(darry.printdet())
print(darry.no_of_leaves)
print(darry.no_of_holiday)
print(darry.printdetail())
print(carry.printdetail())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment