What Will Be The Output Of The Following Programp Pre Langcpp #1093
What will be the output of the following program?</p> <pre><code class="language-cpp"> class Test { public: Test() { cout << "Test's Constructor is Called " << endl; } }; class Result { static Test a; public: Result() { cout << "Result's Constructor is Called " << endl; } }; void main() { Result b; } </code></pre>
This multiple choice question (MCQ) is related to the book/course
gs gs111 OOP Object Oriented Programming Java.
It can also be found in
gs gs111 Exception Handling & Static Class Members - OOPs MCQ: Static Data Members - Quiz No.2.
What will be the output of the following program?
class Test { public: Test() { cout << "Test's Constructor is Called " << endl; } }; class Result { static Test a; public: Result() { cout << "Result's Constructor is Called " << endl; } }; void main() { Result b; }
Test’s Constructor is Called
Result’s Constructor is Called
Result’s Constructor Called Test’s Constructor is Called
Test’s Constructor Called Result’s Constructor is Called