QuesAns Print Page – CSKC
Sign In

Search

siteicon
Q&A CBSE12D-2016-B02E #6475

Question:

What is the significance of super() method? Give an example for the same.

Answer:

super() function is used to call base class methods which has been extended in
derived class.
EX:

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