Question:

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;
}

Answers:


Keywords:

© 2017 QuizBucket.org