Declaring that a class is another class type is only part of the reason to use inheritance. It’s actually much more powerful than just allowing you to refer to a group of different class instances all by some common base type. When you create a new class that derives from a base class, you can actually change the behavior of the base class methods to adapt them to the specific needs of the new derived class.
You start this process in a base class by declaring a method to be virtual. Just use the keyword virtual before the method declaration in the class.
A very important point that you must remember is that if you intend a class to serve as a base class, then make sure to declare the destructor to be virtual. The end of this episode explains how your classes may not be properly destructed if you forget this.
This episode describes a specific example of a class called bee and another class called bumbleBee. Both classes declare a method called sting and they each have slightly different behavior. It’s this difference in behavior that you should be on the lookout for when deciding if you need to inherit from another class.