adplus-dvertising
frame-decoration

Question

Suppose B is a subclass of A, to invoke the __init__ method in A from B, what is the line of code you should write?

a.

A.__init__(self)

b.

B.__init__(self)

c.

A.__init__(B)

d.

B.__init__(A)

Posted under Python

Answer: (a).A.__init__(self)

Engage with the Community - Add Your Comment

Confused About the Answer? Ask for Details Here.

Know the Explanation? Add it Here.

Q. Suppose B is a subclass of A, to invoke the __init__ method in A from B, what is the line of code you should write?