1.

Which access specifier is used where one wants data members to be accessed by other classes but not from outside objects?(a) private(b) protected(c) public(d) both protected and publicThis question was posed to me in quiz.Enquiry is from Access Control in division Class Hierarchies, Library & Containers of C++

Answer»

The correct CHOICE is (B) protected

The best explanation: Protected and public members are ACCESSIBLE from derived classes but public members can be ACCESSED by objects of the class so protected specifier is the answer.



Discussion

No Comment Found

Related InterviewSolutions