Inheritance
The capability of a class to derive properties from another class is called Inheritance
- The class that inherits properties from another class is called Subclass or Derived Class.
- The class whose properties are inherited by a subclass is called Base Class or Superclass.
Syntax for Inheritance
class derived_name : access_mode base_class
{
//body of derived class
};
Additional Information
Polymorphism
Polymorphism is mainly divided into two types:
- Compile-time Polymorphism
- Runtime Polymorphism
Compile-time polymorphism
This is achieved by function overloading or operator overloading.
- Function Overloading - When there are multiple functions with the same name but different parameters then these functions are said to be overloaded
- Operator overloading - When there are multiple operations can be performed by using single operator is called operator overloading for example operator ‘+’ when placed between integer operands, adds them and when placed between string operands, concatenates them
Run Time Polymorphism
It is achieved by Function Overriding.
Conclusion
Feature of Reusability is followed by inheritance so the correct answer is the inheritance.