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
(d).This code violates encapsulation
need an explanation for this answer? contact us directly to get an explanation for this answer