What is the main principle of Object-Oriented Programming (OOP)?
- Abstraction
- Encapsulation
- Inheritance
- Polymorphism
Encapsulation is one of the main principles of Object-Oriented Programming (OOP). It refers to the bundling of data (attributes) and methods (functions) that operate on the data into a single unit or class. Encapsulation helps in hiding the internal complexities of an object and allows access to only the necessary parts through well-defined interfaces. This concept promotes modularity, reusability, and easier maintenance of code in OOP.
Loading...
Related Quiz
- Which type of linked list is best suited for implementing a stack?
- What is the difference between symmetric and asymmetric encryption?
- Explain the concept of DevOps and its relationship with the SDLC.
- You're working on a project to optimize delivery routes for a logistics company. How could you model the problem using graphs, and what algorithms would you use to find the most efficient routes?
- How would you implement a dynamic array from scratch?