✅ Chapter 11 – More on OOP & Inheritance (Advanced OOP Concepts)


📘 1. Inheritance – Reusability & Extension

➕ What it is:

Inheritance allows a class (child/derived) to use properties and methods of another class (parent/base), avoiding code duplication.

class Employee:
    def info(self, name, salary):
        self.name = name
        self.salary = salary
        print(f"The name is {self.name} and salary is {self.salary}")

class Programmer(Employee):  # Inherits everything from Employee
    def status(self):
        print(f"{self.name} is currently inactive")

💡Key Points:


👪 2. Multiple Inheritance

class Employee:
    def info(self, name, salary): ...

class PersonalInfo:
    def age(self, age): ...

class Programmer(Employee, PersonalInfo): ...

💡Key Points:


🧱 3. Multilevel Inheritance

class Employee:
    a = 23

class Programmer(Employee):
    b = 43

class Coder(Programmer):
    c = 34