does c++ support single inheritance

By: Prof. Fazal Rehman Shamil

Question: Does C++ support single inheritance?single inheritance of classes

Answer: Yes, C++ supports the concept of single inheritance between the classes.

In the figure, the sum is the parent class and child is the child class and if the child class wants to sum number 1 and number, then the child can get it from the parent class sum.

These concepts can be represented with a simple C++ program. So, let’s begin with the program.

Example of C++ supporting the single inheritance

C++ program to print a hollow square or rectangle star pattern with the support of single inheritance.

In this example, one is the parent of the class of child class. You can run the program as proof that C++ supports the single inheritance

Output

does c++ support single inheritance