Question:

How many times is Hello World printed by this program?

#include <iostream>

struct BS
{
  BS()
  {
    std::cout << "Hello World" << std::endl;
  }
};

struct mid1 : public BS { };
struct mid2 : public BS { };
struct mid3 : public BS { };
struct mid4 : public BS { };

struct DR : public virtual mid1, public virtual mid2, public virtual mid3, public mid4 { };

int main(int argc, char** argv) 
{ 
  DR d;
  return 0; 
}

 

Answers:


Keywords:

© 2017 QuizBucket.org