My C++ Quiz

The ultimate place to learn C++!

Question #35: What value gets printed by the program?

#include <iostream>

struct Foo
{
  int x;

  operator int()
  {
    return 21;
  }
};

int main(int argc, char** argv)
{
  Foo f;
  f.x = 11;

  std::cout << (0?3:f) << std::endl;

  return 0;
}