Classes Are Customized by Inheritance : Inheritance : Class PYTHON TUTORIALS


PYTHON TUTORIALS » Class » Inheritance »

 

Classes Are Customized by Inheritance


class FirstClass:          
    def setdata(self, value)
        self.data = value     
    def display(self)
        print self.data       

class SecondClass(FirstClass)
    def display(self):         
        print 'Current value = "%s"' % self.data 

z = SecondClass(  ) 
z.setdata(42)                
z.display(  )



Leave a Comment / Note


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


PYTHON TUTORIALS

 Navioo Class
» Inheritance