What will be printed out as a result of the following code execution?
#include <iostream>
using namespace std;

class Shape
{
    virtual void show() = 0;
};
class Circle: public Shape
{
    void show()
    {
        std::cout<<"Circle\n";
    }
};
class Triangle: Shape
{
    void show()
    {
        std::cout<<"Triangle\n";
    }
};

int main(int argc, char* argv[]) 
{
    Shape* shape1;
    shape1 = new Circle();
    shape1->show();
    Shape* shape2 = new Triangle();
    shape2->show();
    delete shape1;
    delete shape2;
    return 0;
}

Follow CodeGalaxy

Mobile Beta

Get it on Google Play
Send Feedback
Cosmo
Sign Up Now
or Subscribe for future quizzes