Consider The Following Code And Select The Correct Optionp Pre #87
Consider the following code and select the correct option.</p> <pre><code class="language-cpp"> class student { int marks; public : int* fun() { return &marks; } }; main() { student s; int *ptr=c.fun(); return 0; } </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 Concept & Features - OOPs MCQ: Encapsulation - Quiz No.2.
Consider the following code and select the correct option.
class student { int marks; public : int* fun() { return &marks; } }; main() { student s; int *ptr=c.fun(); return 0; }
This code is good to go
This code may result in undesirable conditions
This code will generate error
This code violates encapsulation