-
What is the output of this program?
#include <iostream>
using namespace std;
class InterfaceClass
{
public:
virtual void Display() = 0;
};
class ClassA : public InterfaceClass
{
public:
void Display()
{
int num = 10;
cout << num;
}
};
class ClassB : public InterfaceClass
{
public:
void Display()
{
cout <<" 14" << endl;
}
};
int main()
{
ClassA object1;
object1.Display();
ClassB object2;
object2.Display();
return 0;
}
-
- 10
- 14
- 14 10
- 10 14
- None of these
Correct Option: D
In this program, We are displaying the data from the two classes
by using abstract class.