English

Explain data hiding with respect to OOP.

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?
Chapter 2: Concept of Object Oriented Programming - EXCERCISE [Page 37]

APPEARS IN

CBSE Computer Science with Python [English] Class 12
Chapter 2 Concept of Object Oriented Programming
EXCERCISE | Q 9. | Page 37
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×