ExamVeda
Login
Home
C plus plus miscellaneous
?

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

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.