• Source
    1. class Employee:
    2. 'Common base class for all employees'
    3. empCount = 0
    4.  
    5. def __init__(self, name, salary):
    6. self.name = name
    7. self.salary = salary
    8. Employee.empCount += 1
    9.  
    10. def displayCount(self):
    11. print "Total Employee %d" % Employee.empCount
    12.  
    13. def displayEmployee(self):
    14. print "Name : ", self.name, ", Salary: ", self.salary
    15.  
    16. "This would create first object of Employee class"
    17. emp1 = Employee("Zara", 2000)
    18. "This would create second object of Employee class"
    19. emp2 = Employee("Manni", 5000)
    20. emp1.displayEmployee()
    21. emp2.displayEmployee()
    22. print "Total Employee %d" % Employee.empCount