Computer Science, asked by pr257997, 8 months ago


Write a program in C++ to show the concept of single inheritance.​

Answers

Answered by uniyalsudhir368
0

Answer:

C++ Single Inheritance Block Diagram As shown in the figure, in C++ single inheritance only one class can be derived from the base class. Based on the visibility mode used or access specifier used while deriving, the properties of the base class are derived. Access specifier can be private, protected or public.

Inheritance in C++ - GeeksforGeeks

Explanation:

plz markbrainlist

Answered by Anonymous
0

A program in C++ to show the concept of single inheritance is as follows:

#include <bits/std c++ .h>

using namespace std ;

class Super

{

      public :

     int x_y ;

} ;

class Sub : public Super

{

     public :

     int x_z;

} ;

int main( )  

   {

       Sub instance1 ;

       instance1. x_z = 8 ;

       instance1. x_y = 41 ;

       cout << "Sub x is " <<  instance1. x_z  << endl ;

       cout << "Super x is " <<  instance1. x_y  << endl ;  

       return 0;

    }  

Similar questions