For The Following Code Choose The Correct Optionp Pre Langcpp #228
For the following code, choose the correct option.</p> <pre><code class="language-cpp"> class A { int marks; protected : A() { marks=100; } public : A( int x) { marks=x; } }; </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 OOps Access Specifiers - OOPs MCQ: Protected Access Specifier - Quiz No.1.
For the following code, choose the correct option.
class A { int marks; protected : A() { marks=100; } public : A( int x) { marks=x; } };
The instances can be created only in subclasses
The instances can be created only in main() function
The instances can be created only in parent class
The instances can be created anywhere in the program