What is encapsulation in object-oriented programming?

Questions & AnswersCategory: PythonWhat is encapsulation in object-oriented programming?
Lokesh Kumar Staff asked 2 years ago

What is encapsulation in object-oriented programming?
a. Encapsulation is a kind of generalization, usually presented as an abstract class.
b. Encapsulation hides the implementation from the user of the class. An example of use is declaring variables as private. We don’t want to give access to these variables externally. We want to have hermetically sealed objects that will not be damaged by accident.
c. Encapsulation allows us to define a class that inherits all the methods and properties from another class.