According to the C++23 standard, what is the output of this program?
#include <iostream>
class A {
public:
A() { std::cout << 'a'; }
~A() { std::cout << 'A'; }
};
class B {
public:
B() { std::cout << 'b'; }
~B() { std::cout << 'B'; }
A a;
};
int main() { B b; }When are member variables initialized and destroyed?
abBA
Member variables are initialized before the constructor is called. The destructor is called before member variables are destroyed.