What is a derived class? Define concrete derived class.
- A derived class is a class that inherits the properties from its super class. For example, a Cat is a super class and Monx cat is a derived class which has all properties of a Cat and does not have a tail.
- A concrete derived class is a derived class which implements the all functionality that are missed in the super class.
Explain Derived class with an example using C++.
- Inheritance is one of the important feature of OOP which allows us to make hierarchical classifications of classes. In this, we can create a general class which defines the most common features. Other more specific classes can inherit this class to define those features that are unique to them. In this case, the classes which inherit from other classes, is referred as derived class.
- For example, a general class vehicle can be inherited by more specific classes car and bike. The classes car and bike are derived classes in this case.
class car : public class vehicle
class bike : public class vehicle