InheritanceCalling Methods in the Base Classclass A: def foo(self): print "Class A: foo" class B(A): # Inherits from class A def foo(self): print "Class B: foo" A.foo(self) # Call foo-method in class A Most commonly used in object initializationclass B(A): def __init__(self,args): # Initialize the base class A.__init__(self) # Initialize myself ... |
<<< | O'Reilly OSCON 2000, Introduction to Python, Slide 97 July 17, 2000, beazley@cs.uchicago.edu |
>>> |