Python Programming - Classes - Discussion

Discussion Forum : Classes - General Questions (Q.No. 26)
26.
Consider the following Python code:
class Vehicle:
    def __init__(self, brand):
        self.brand = brand

class Car(Vehicle):
    def __init__(self, brand, model):
        super().__init__(brand)
        self.model = model
What concept of object-oriented programming is demonstrated in this code?
Polymorphism
Encapsulation
Inheritance
Abstraction
Answer: Option
Explanation:
The code illustrates the concept of inheritance, where the `Car` class inherits from the `Vehicle` class, inheriting its attributes and methods.
Discussion:
Be the first person to comment on this question !

Post your comments here:

Your comments will be displayed after verification.