Self For Class
class Employee():
no_of_leaves= 8
def printdetails(self):
return f"Name is {self.name}. Salary is {self.salary}. Role is {self.role}. "
harry = Employee()
rohan = Employee()
harry.name = "Harry"
harry.salary = 455
harry.role = "Instructor"
rohan.name = "Rohan"
rohan.salary = 4554
rohan.role = "Student"
print(rohan.printdetails())
Comments
Post a Comment