1.

Why do classes use accessor methods?(a) To make public data accessible to client(b) To make public data private to client(c) To make private data public for whole program(d) To make private data accessible to the clientI have been asked this question during an online interview.Enquiry is from Class Use topic in division Classes of Object Oriented Programming

Answer»

Correct answer is (d) To make private data accessible to the client

Explanation: The private data of a class is usually not accessible. But the data can be accessed by the USER using ACCESSOR FUNCTIONS. These functions ALLOWS the user to get the data stored as private in a class.



Discussion

No Comment Found

Related InterviewSolutions