Created
August 5, 2012 02:53
-
-
Save omkz/3261280 to your computer and use it in GitHub Desktop.
python class
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Employee: | |
'Common base class for all employees' | |
empCount = 0 | |
def __init__(self, name, salary): | |
self.name = name | |
self.salary = salary | |
Employee.empCount += 1 | |
def displayCount(self): | |
print "Total Employee %d" % Employee.empCount | |
def displayEmployee(self): | |
print "Name : ", self.name, ", Salary: ", self.salary | |
omenk = Employee('Kurnia muhamad', 90000) | |
omenk.displayEmployee() | |
omenk.displayCount() | |
print omenk.salary |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment