A common query of programmers new to object-oriented programming (OOP) is why is a derived class known as a “sub-class” when, by definition, it contains more member properties/functions than the base class (aka super-class) than it inherited from?
The trick to understanding this concept is to remember that Computer Science has Mathematics as its roots, and “class” is synonymous with “set” in set theory. Thus, when you declare a class, you’re really declaring a set of instances with the defined properties; when you declare a derived class, you introduce additional criteria (properties), thus effectively declaring a specialization of the base class – i.e. a sub class.
E.g.
class Mammal{
...
}
class Dog: public Mammal{
public:
void bark();
...
}
The above code could be represented as the below Venn diagram:

Venn diagram depicting a class and its sub-class
- Lem





