Question:

What gets printed by this program?

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

Answers:


Keywords:

© 2017 QuizBucket.org