How to use class with super to access parent class methods in Python

1 Answer

0 votes
class Worker:
    def name(self):
        print("Emma")

class School(Worker):
    def name(self):
        print("Hogwarts ")
        super().name()

o = School()
o.name()





'''
run:

Hogwarts 
Emma

'''

 



answered Oct 8, 2020 by avibootz

Related questions

1 answer 196 views
1 answer 350 views
1 answer 200 views
1 answer 184 views
...