Python | Classes Quiz | Question 17

Last Updated :
Discuss
Comments

Consider the following Python code:

class A:
   def __init__(self, x):
       self.x = x

class B(A):
   def __init__(self, x, y):
       super().__init__(x)
       self.y = y


What is the relationship between the A and B classes?

Composition

Inheritance

Encapsulation

Polymorphism

Share your thoughts in the comments