Create new classes from existing ones to reuse code and establish relationships.
Inheritance is a fundamental principle of Object-Oriented Programming that allows a new class, called the derived class (or subclass), to be based on an existing class, called the base class (or superclass). The derived class inherits the public and protected members (both variables and functions) of the base class. This models an 'is-a' relationship. For example, a `Car` is a `Vehicle`, so you could have a `Vehicle` base class and a `Car` derived class. The `Car` class would automatically have all the properties of a `Vehicle` (like `speed`, `weight`) and could add its own specific properties (like `numberOfDoors`). The syntax for inheritance is `class DerivedClass : accessSpecifier BaseClass { ... };`. The `accessSpecifier` (usually `public`) determines how the inherited members of the base class are accessed from within the derived class and by outside code. With `public` inheritance, public members of the base class become public members of the derived class, and protected members of the base class become protected members of the derived class. Private members of the base class are not accessible by the derived class at all. Inheritance is a powerful tool for code reuse, as you can write common functionality in a base class and then create multiple specialized derived classes without duplicating code. It also forms the foundation for polymorphism.