This post will introduce the concept of inheritance.
Inheritance is a very important concept for object orientation. It is the idea that you can write a class, and borrow stuff from another class. It can also be referred to as extending a class.
Look at the code below where you have the “PartyAnimal” class, and a new class “FootballFan”. “FootballFan” extends “PartyAnimal”. Thus, “FootballFan” has the member variable “x”, “name”, and “points”. Everything from “PartyAnimal” gets pulled into the new class, plus another method is added.
You can see that “FootballFan” is a class which extends “PartyAnimal”. It has all the capabilities of “PartyAnimal” and more.