Question OOP-ENC-0044
MediumWhat is the output of this code?
#include <iostream>
using namespace std;
class Secret {
int code = 42;
friend void reveal(const Secret &s);
};
void reveal(const Secret &s) { cout << s.code; }
int main() {
Secret s;
reveal(s);
}
- A.
42
- B.
Garbage value
- C.
Sign up free to see the answer and a step-by-step explanation.