1.

Which among the following best describes encapsulation?(a) It is a way of combining various data members into a single unit(b) It is a way of combining various member functions into a single unit(c) It is a way of combining various data members and member functions into a single unit which can operate on any data(d) It is a way of combining various data members and member functions that operate on those data members into a single unitThe question was posed to me during an interview.My enquiry is from Encapsulation topic in chapter OOPs Concept & Features of Object Oriented Programming

Answer»

Right choice is (d) It is a way of COMBINING various data members and member functions that OPERATE on those data members into a single UNIT

Best explanation: It is a way of combining both data members and member functions, which operate on those data members, into a single unit. We call it a class in OOP generally. This feature have helped us modify the structures used in C LANGUAGE to be UPGRADED into class in C++ and other languages.



Discussion

No Comment Found

Related InterviewSolutions