Tech moves fast! Stay ahead of the curve with Techopedia!
Join nearly 200,000 subscribers who receive actionable tech insights from Techopedia.
A derived class is a class created or derived from another existing class. The existing class from which the derived class is created through the process of inheritance is known as a base class or superclass.
Derived classes are used for augmenting the functionality of base class by adding or modifying the properties and methods to suit the requirements of the specialization necessary for derived class. This allows for defining virtual methods that form the means to implement polymorphism, which allows a group of objects to work in uniform manner. Thus, the inherent advantages of inheritance and polymorphism like code reuse, faster development, easy maintenance, etc., are realized.
A derived class is also known as subclass or child class.
The hierarchical relationship between derived class and base class is known as an “is a” relationship. For example, consider a base class, LivingBeing, which is used to create two derived classes, Plant and Animal. Plant is a LivingBeing and Animal is a LivingBeing. Both have few common features but each type can have features that are unique to its specialization and are different from the features of the base class.
While inheriting from base class, the derived class implicitly inherits all the members (except constructors and destructors), which it reuses as it extends and modifies the behavior of the base class. The derived class overrides the properties and methods of the base class so that it represents the specialized version of base class.