Advertisements
Advertisements
Question
Explain data hiding with respect to OOP.
Explain
Advertisements
Solution
Data hiding is the mechanism of restricting direct access to the data of a class from outside the class.
- It protects data from accidental or intentional misuse.
- It is achieved by making data members
private. - Private data can be accessed only through the methods of the same class, while public members can be accessed from outside.
shaalaa.com
Is there an error in this question or solution?
