#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: ________ {
#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 {
};
Comments
Leave a comment