What is encapsulation in OOP?

Object Oriented Programming Questions



47 Short 36 Medium 25 Long Answer Questions Question Index

What is encapsulation in OOP?

Encapsulation in Object-Oriented Programming (OOP) is the concept of bundling data and methods together within a class, and controlling access to them through the use of access modifiers. It allows for the hiding of internal implementation details and provides a way to protect data from being accessed or modified directly by external entities. Encapsulation promotes data integrity and code reusability by enforcing the principle of information hiding.