My C++ Quiz

The ultimate place to learn C++!

Question #55: What gets printed by this program?

#include <iostream>

struct Shape
{
  void print()
  {
    std::cout << "SHAPE" << std::endl;
  }
};

struct Box : public Shape
{
  void print()
  {
    std::cout << "BOX" << std::endl;
  }
};

int main(int argc, char** argv)
{
  Shape* s1 = new Box;

  s1->print();

  return 0;
}