super() in a diamond
QuizMediumPython onlyAsked in: Accenture, TCS
What does print(D().hi()) print?
class A:
def hi(self): return "A"
class B(A):
def hi(self): return "B" + super().hi()
class C(A):
def hi(self): return "C" + super().hi()
class D(B, C):
passBCABABACA- TypeError: ambiguous inheritance
This question is part of Pro+
Pro+ opens every question in Interview Prep and the mock interview. Every article and the first 2 questions of each topic stay free. Hands-on Selenium and API tasks follow their course lesson's own lock.