What is the difference between abstraction and encapsulation in OOP?
- Abstraction is bundling data and methods while encapsulation is exposing implementation details.
- Abstraction is bundling data and methods while encapsulation is hiding implementation details.
- Abstraction is exposing implementation details while encapsulation is bundling data and methods.
- Abstraction is hiding implementation details while encapsulation is bundling data and methods.
Abstraction in OOP refers to the concept of hiding complex implementation details and showing only essential features of an object. Encapsulation, on the other hand, involves bundling the data (attributes) and methods (functions) that operate on the data into a single unit, i.e., a class. This helps in achieving data hiding and access control.
Loading...
Related Quiz
- You're working on a banking system where financial transactions need to be securely stored and retrieved. How would you design the database schema and implement transaction management in this scenario?
- The Banker's algorithm operates by simulating the allocation of _______ to processes and checks if granting the requests leads to a safe state.
- Your Agile team is struggling to meet sprint goals due to frequent interruptions. How would you address this issue while maintaining Agile principles?
- The ___________ model combines elements of both predictive and adaptive approaches to software development.
- Discuss the concept of a monitor in synchronization.