What is a derived class? Define concrete derived class.

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 vehicle
{
   int fuel_cap;
   public:
       drive();
};

class car : public class vehicle
{
   public:
       roll_windows();
};

class bike : public class vehicle
{
   public:
       kick_start();
};
Numeric, character and boolean data types - C++
Numeric: This is a fundamental type provided by C++ language. Integers, Floating point types come under this...
What is Typecasting? Explain with examples.
Typecasting: C++ is very strict about type compatibility. Different variable types must be cast when their values are assigned to each other.
Explain (scope resolution operator) :: operator with an example - C++
Explain :: operator with an example - :: Operator: ‘::’ is known as Scope Resolution Operator...
Post your comment