adplus-dvertising
frame-decoration

Question

What is the output of this program?
    #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

Answer: (c).5 5

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?