parabola(line)which means that parabola is subclass of line and inherits all its methods and attributes the new parabola class therefore has attributes and and three methods __init____call__and table line is base class (or parent classsuperclassand parabola is subclass (or child classderived classthe new parabola classthereforeis not as useless as it first seemedbut it is still just copy of the line class to make the class represent parabolawe need to add the missing codethat isthe code that differs between line and parabola when creating such subclassesthe principle is to reuse as much as possible from the base classonly add what is needed in the subclassand avoid duplicating code inspecting the two original classes abovewe see that the parabola class must add code to line' constructor (an extra attributeand an extra term in __call__but table can be used unaltered the full definition of parabola as subclass of line becomes the followingclass parabola(line)def __init__(selfc )super(__init__( line stores self def __call__(selfx)return super(__call__(xself * ** to maximize code reusewe allow the parabola class to call the methods from lineand then add the missing parts subclass can always access its base class bt using the built-in function super()and this is the preferred way to call methods from the base class we couldhoweveralso use the class name directlyfor instance line __init__(self, , generallythese two methods for invoking superclass methods look like the followingsuperclassname method(selfarg arg super(method(arg arg notice the difference between the two approaches when using the class name directlywe need to include self as the first argumentwhereas this aspect is handled automatically when using super(the use of super(is usually preferredbut in most cases the two approaches are equivalent to summarize this first examplethe main benefits of introducing the subclass are as followsclass parabola just adds code to the already existing code in class linewith no duplication of the code for storing and and computing class parabola also has table methodit is inherited and does not need to be written __init__ and __call__ are overridden or redefined in the subclasswith no code duplication we can use the parabola class and call its methods just as if they were implemented in the class directly