0

Please i want to understand this code, according to my understanding of super in class base programming i know its being used on the base class to access methods and attributes of the base class but here like in this code below

class Base:
   def __init__(self,name, age):
       self.name = name 
       self.age = age

class Sub(Base):    
    def __init__(self,name, age, first_name):
        super().__init__(name, age)
        self.first_name = first_name

But i cannot understand this code below seeing the super being called on the same class with the init function, what does this mean and how does it affect the program

class MyClass(object):
def __init__(self):
    super(MyClass, self).__init__()
    self.numeric_var = 1
ade desmond
  • 432
  • 1
  • 8
  • 24

0 Answers0