Classes Are Customized by Inheritance : Inheritance « Class « Python Tutorial






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(  )








11.11.Inheritance
11.11.1.Inherit from two base classes
11.11.2.OOP and Inheritance: "Is-a" Relationships
11.11.3.Specializing Inherited Methods
11.11.4.Classes Are Customized by Inheritance