adplus-dvertising
frame-decoration

Question

What is the output of this program?
    #include <iostream>
    using namespace std;
    class sample
    {
        public:
        virtual void example() = 0; 
    };
    class Ex1:public sample
    {
        public:
        void example()
        {
            cout << "ubuntu";
        }
    };
    class Ex2:public sample
    {
        public:
        void example()
        {
            cout << " is awesome";
        }
    };
    int main()
    {
        sample* arra[2];
        Ex1 e1;
        Ex2 e2;
        arra[0]=&e1;
        arra[1]=&e2;
        arra[0]->example();
        arra[1]->example();
    }

a.

ubuntu

b.

is awesome

c.

ubuntu is awesome

d.

none of the mentioned

Answer: (c).ubuntu is awesome

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?