OOPs | 04-Encapsulation

Access Modifier

4.1 Encapsulation in Python

  • Access modifier are useful to attain encapsulation
  • It is archived by access modifiers public, private, protected

Python does not have strong distinctions between private and public variables like Java does.

There is no private-ness in python, as one of Python principles says –> We're all adults

# They just follow convention
Single underscore `_`
    --> its suppose to be protected
Double underscore `__`
    --> Do not use this field directly

# It is called Name Mangling
[Read More]