|
Question #58: What gets printed by this program?
58% on 877 times asked
#include <iostream>
struct Shape
{
virtual void print()
{
std::cout << "SHAPE" << std::endl;
}
virtual ~Shape() {}
};
struct Box : public Shape
{
virtual void print(int i)
{
std::cout << "BOX" << std::endl;
}
};
int main(int argc, char** argv)
{
Shape* s = new Box;
s->print();
delete s;
return 0;
}
|