Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

python child class call parent method

# use the super method:

class Foo(Bar): # the child class
    def baz(self, **kwargs):
        return super().baz(**kwargs)

# For Python < 3, you must explicitly opt in to using new-style classes and use:

class Foo(Bar): # the child class
    def baz(self, arg):
        return super(Foo, self).baz(arg)
        
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #python #child #class #call #parent #method
ADD COMMENT
Topic
Name
2+8 =