Creating Subclasses : Subclass : Class PYTHON TUTORIALS


PYTHON TUTORIALS » Class » Subclass »

 

Creating Subclasses


class Parent(object):        
     def parentMethod(self):
        print 'calling parent method'
class Child(Parent):         
     def childMethod(self):
         print 'calling child method'
p = Parent()                 
p.parentMethod()
c = Child()                  
c.childMethod()              
c.parentMethod()



Leave a Comment / Note


 
Verification is used to prevent unwanted posts (spam). .


PYTHON TUTORIALS

 Navioo Class
» Subclass