Skip to main content

/docs/images/banner.jpg

Python

Single Inheritance

Title: WAP to implement single inheritance

# WAP to implement single inheritance

class A:
def __init__(self):
print("Class A")


class B(A):
def __init__(self):
print("Class B")
super().__init__()


b = B()
# Output:
# Class B
# Class A

note

Single inheritance cannot have two base classes