ExamVeda
Login
Home
C plus plus miscellaneous
?

What will be the output of the following C++ code?
#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;
}

Answer & Solution
Correct Answer: Option C
Let's discuss the solution. Join the discussion
Examveda
Question posted by Examveda
Community

Join the Discussion

No comments yet Be the first to discuss this question.