I have a Python ABC (let's call it A
) with a concrete __init__()
method, as well as a class that implements this ABC (let's call it B
). As far as I understand, I should not be able to instantiate the ABC.
Question: Why and how is the call super().__init__()
inside the __init__
function of class B
working? I assume that super()
creates an instance of the parent class - which in this case is the ABC.
Class A
from abc import ABC, abstractmethod
from util.fileManager import FileManager
class A(ABC):
def __init__(self):
self.file_manager = FileManager() # Composition object
...
Class B, implementing class A
from interfaces.A import A
class B(A):
def __init__(self):
super().__init__()
...
Edit / Solution
As many of you've probably seen, this question really boils down to what super()
does in Python. Accepting the answer I marked, I really want to point to the link in @KarlKnechtel's comment, since it helped me further understand the situation.