Q:

Consider the following code and select the correct option:

0

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;
}

  1. This code is good to go
  2. This code may result in undesirable conditions
  3. This code will generate error
  4. This code violates encapsulation

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

(d).This code violates encapsulation

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

This question belongs to these collections

Similar questions


need a help?


find thousands of online teachers now