Question
#include <iostream>
using namespace std;
class MyInterface
{
public:
virtual void Display() = 0;
};
class Class1 : public MyInterface
{
public:
void Display()
{
int a = 5;
cout << a;
}
};
class Class2 : public MyInterface
{
public:
void Display()
{
cout <<" 5" << endl;
}
};
int main()
{
Class1 obj1;
obj1.Display();
Class2 obj2;
obj2.Display();
return 0;
}
a.
5
b.
10
c.
5 5
d.
None of the mentioned
Posted under Object Oriented Programming Using C++
Engage with the Community - Add Your Comment
Confused About the Answer? Ask for Details Here.
Know the Explanation? Add it Here.
Q. What is the output of this program?
Similar Questions
Discover Related MCQs
Q. What is meant by pure virtual function?
View solution
Q. Pick the correct option.
View solution
Q. Where does the abstract class is used?
View solution
Q. Which interface determines how your class will be used by other program?
View solution
Q. Pick out the correct statement about override.
View solution
Q. How many ways of reusing are there in class hierarchy?
View solution
Q. How many types of class are there in c++?
View solution
Q. Pick out the correct statement about multiple inheritance.
View solution
Q. What does inheriatance allows you to do?
View solution
Q. What is the syntax of inheritance of class?
View solution
Q. How many kinds of classes are there in c++?
View solution
Q. What is meant by polymorphism?
View solution
Q. How many types of inheritance are there in c++?
View solution
Q. What is meant by containership?
View solution
Q. How many types of constructor are there in C++?
View solution
Q. How many constructors can present in a class?
View solution
Q. What should be the name of constructor?
View solution
Q. What does derived class does not inherit from the base class?
View solution
Q. What is a template?
View solution
Q. Pick out the correct statement about string template.
View solution
Suggested Topics
Are you eager to expand your knowledge beyond Object Oriented Programming Using C++? We've curated a selection of related categories that you might find intriguing.
Click on the categories below to discover a wealth of MCQs and enrich your understanding of Computer Science. Happy exploring!