Question
What is the significance of super() method? Give an example of the same.
Solution
Super() function is used to call base class methods which have been extended in the derived class.
Example-
class GradStudent ( Student ):
def __init__ ( self ):
super ( GradStudent , self ). __init__ ()
self . subject = ''
self . working = ''
def readGrad ( self ):
# Call readStudent method of parent class
super ( GradStudent , self ). readStudent ()