Which Among The Following Is Correct Based On The Given Code #135
Which among the following is correct, based on the given code below?</p> <pre><code class="language-cpp"> class student { int marks; public : student() { cout<<”New student details can be added now”; } }; student s1; </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 Constructors and Destructors - OOPs MCQ: Types of Constructors - Quiz No.2.
Which among the following is correct, based on the given code below?
class student { int marks; public : student() { cout<<”New student details can be added now”; } }; student s1;
Cout can’t be used inside the constructor
Constructor must contain only initializations
This program works fine
This program produces errors