What if you could take an existing class and say "I want everything this already does, plus a few things of my own"? That's inheritance. Let's talk about it.

Okay so here's a thought experiment.

Imagine you're building an anime RPG. You need a Ninja class. You create it, give it a name, a village, and a method called fight(). Great. Done.

Then you realise you also need a Hokage class. A Hokage is still a ninja β€” they have a name, they belong to a village, they can fight. But they also have extra responsibilities. They lead. They make speeches. They sign off on missions.

Now you have a choice. You could copy and paste everything from Ninja into Hokage. But that's a nightmare β€” every time you update Ninja, you'd have to update Hokage too, and if you forget, the two drift apart and weird bugs show up.