QUESTION IMAGE
Question
what is encapsulation in oop?
the process of exposing all data and methods of a class.
the ability of an object to access data from other objects.
the practice of hiding internal data and methods within a class and providing controlled access.
the process of converting data from one type to another.
question 8
1 pts
what is the purpose of using private attributes in encapsulation?
to make the code more complex.
to prevent direct access to attributes from outside the class.
to improve the performance of the code.
to allow unlimited access to attributes.
For the first question, encapsulation in OOP is a core principle focused on hiding internal class details and enabling controlled access. For the second question, private attributes restrict direct external access to protect data integrity.
Snap & solve any problem in the app
Get step-by-step solutions on Sovi AI
Photo-based solutions with guided steps
Explore more problems and detailed explanations
The practice of hiding internal data and methods within a class and providing controlled access.
To prevent direct access to attributes from outside the class.