Answer
Inheritance lets a class derive attribute behavior from base classes. β’ A subclass lists its bases in the class definition. β’ Method resolution order controls attribute lookup across bases. β’ Composition may be clearer when the relationship is not truly βis-a.β
💡 Simple Example
class Animal:
def speak(self):
return 'sound'
class Dog(Animal):
pass
print(Dog().speak())
Output
sound
⚡ Quick Revision
Inheritance lets subclasses reuse and specialize base-class behavior.