DigitMagazine

Defining and creating a class in Python 3

Aug 25th, 2018
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1. class Employee:
  2. 'Common base class for all employees'
  3. empCount = 0
  4.  
  5. def __init__(self, name, empid, location):
  6. self.name = name
  7. self.empid = empid
  8. self.location = location
  9. Employee.empCount += 1
  10. def displayCount(self):
  11. print ("Total Employee %d" % Employee.empCount)
  12. def displayEmployee(self):
  13. print ("Name : ", self.name, ", Employee Code: ", self.empid, ", Location: ", self.location)
Add Comment
Please, Sign In to add comment