1.

Which among the following can be a concept against encapsulation rules?(a) Using function pointers(b) Using char* string pointer to be passed to non-member function(c) Using object array(d) Using any kind of pointer/array address in passing to another functionI had been asked this question by my school teacher while I was bunking the class.My question is taken from Encapsulation in chapter OOPs Concept & Features of Object Oriented Programming

Answer»

Correct choice is (d) Using any kind of pointer/array address in passing to ANOTHER function

To explain I would say: If we USE any kind of array or pointer as data member which should not be changed, but in some case its address is passed to some other function or similar VARIABLE. There are chances to MODIFY its whole data easily. Hence Against encapsulation.



Discussion

No Comment Found

Related InterviewSolutions