Question OOP-ENC-0015
HardWhat is the output of this code?
class Secret {
int x = 5;
};
int main() {
Secret obj;
return obj.x;
}
- A.
0
- B.
Compilation error
- C.
Sign up free to see the answer and a step-by-step explanation.
Popular companies
Prepare company by company
Hiring pattern, syllabus, past questions and mocks for each company.
All companiesPractice by subject
Encapsulation question
What is the output of this code?
class Secret {
int x = 5;
};
int main() {
Secret obj;
return obj.x;
}
0
Compilation error
Sign up free to see the answer and a step-by-step explanation.
5
Garbage value