C++ Interview Questions

Bjarne-stroustrup
 
Prev5 of 17Next

According to the C++11 standard, what is the output of this program?

#include <iostream>

struct A {
	A() { std::cout << "A"; }
};
struct B {
	B() { std::cout << "B"; }
};

class C {
public:
	C() : a(), b() {}

private:
	B b;
	A a;
};

int main()
{
	C();
}

Answer