Question OOP-CTOR-0008
MediumWhat is the output of this code?
#include <iostream>
using namespace std;
struct X {
char n;
X(char c) : n(c) { cout << (char)(n - 32) << " "; }
~X() { cout << n << " "; }
};
int main() {
X a('a');
X b('b');
return 0;
}
- A.
B A b a
- B.
A B a b
- C.
Sign up free to see the answer and a step-by-step explanation.