class Employee(object): empcount = 0 def __init__(self,name,sal): self.name = name self.sal = sal Employee.empcount += 1 print "Calling base class" def displaycount(self): print Employee.empcount def displayName(): print self.name def displaySal(): print self.sal class Person(Employee): def __init__(self,name,sal): super(Person, self).__init__(name,sal) print "Calling child class" child = Person("mithun11","212312") child.displaycount() #emp = Employee("mithun","10000") #emp.displaycount()
Run
Reset
Share
Import
Link
Embed
Language▼
English
中文
Python Fiddle
Python Cloud IDE
Follow @python_fiddle
Browser Version Not Supported
Due to Python Fiddle's reliance on advanced JavaScript techniques, older browsers might have problems running it correctly. Please download the latest version of your favourite browser.
Chrome 10+
Firefox 4+
Safari 5+
IE 10+
Let me try anyway!
url:
Go
Python Snippet
Stackoverflow Question