0

I am new to Python and I want to practice a parent and derived class. I want to call parent function to the child class using super. But I got some error. Code is

class First:
    def my_func():
        print('first')

class Second(First):
    def my_func1():
        super().my_func()
        print('second')

obj = Second()
obj.my_func1()
Hari
  • 31
  • 1
  • 3

1 Answers1

2
class First:
    def my_func(self):
        print('first')

class Second(First):
    def my_func1(self):
        super().my_func()
        print('second')

obj = Second()
obj.my_func1()
Hari
  • 31
  • 1
  • 3