#######Classes ####### class myClass(): # used for procedral, capsulated programming def method1(self): #used to share programmign code print "myClass method1" def method2(self, someString): #self arguement print "myClass method2: " + someString class anotherClass(myClass): def method2(self): #not in use as of it print "anotherClass method2" def method1(self): myClass.method1(self); print "anotherClass method1" ############ exercise the class methods############33 def main(): c = myClass() c.method1() c.method2("This is a string") c2 = anotherClass() c2.method1() c2.method2() if __name__ == "__main__": main()
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