InterviewSolution
| 1. |
Define encapsulation in context to OOPS. |
|
Answer» The concept of encapsulation (or OOP Encapsulation) in object-oriented computer programming (OOP) languages REFERS to the bundling of data and the functions that OPERATE on that data into a single unit. Encapsulation is commonly used in the form of classes in several programming languages. A class is a type of program-code template that allows programmers to design objects with both variables (data) and behaviours (functions or methods). In computer science, a class is an example of encapsulation since it consists of data and procedures that have been bundled into a single unit. Encapsulation can also refer to a mechanism that prevents users from directly accessing specific components of an object, such as state values for all of the object's variables. Data members as well as data functions or methods linked with an instantiated class or object can be hidden via encapsulation. There are a few fundamental advantages of encapsulation in programming. These are some of them:
|
|