Answer to Question #237933 in C++ for vfggy

Question #237933


#include <iostream>

using namespace std;

class A {

  protected:

    char i;

  public:

    A(char a): i(a) {}

    void display(char x){

      cout << x << " ";

    }

// create abstract function fun()

    ______________________;       

};

class B: ________ {             

  public:

    B(int a = 0): A(a) {}

    void fun(){ display(i+1); }

};

class C: ________ {             

  public:

    C(int a = 0): A(a) {}

    void fun(){ display(i+2); }

};

class D: ________ {           


1
Expert's answer
2021-09-16T13:01:52-0400
#include <iostream>


using namespace std;


class A {


  protected:


    char i;


  public:


    A(char a): i(a) {}


    void display(char x){


      cout << x << " ";


    }


// create abstract function fun()


     virtual void fun() = 0;       


};


class B: public A{             


  public:


    B(int a = 0): A(a) {}


    void fun(){ display(i+1); }


};


class C:public A{             


  public:


    C(int a = 0): A(a) {}


    void fun(){ display(i+2); }


};


class D: public A {  
    
};

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS