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