Learn Before
Concept

Encapsulation in Python

Encapsulation is an important concept of OOP. It is used to make data in a class private so that the data can not be accessed outside of the class. We create a getter method, for the object to safely access the data without directly interacting with the data itself. We make a variable private by prefixing the variable name by double underscores, e.g. __password = 123

0

1

Updated 2021-02-16

Contributors are:

Who are from:

Tags

Python Programming Language

Data Science