Access Modifiers in python || add single or double underscore prefix.

Опубликовано: 14 Октябрь 2024
на канале: Vinay Coding Tutorial
60
4

You will learn the access Modifiers like How we can create public, private and protected members to access it. Like in java, C++ there is no keywords like public, private, protected access Modifiers in python.
To make public members there is no need to add single/ double underscore prefix. All the members are public by default. They can be accessed from outside the class.

To make private members there is need to add single underscore prefix. They can be accessed from within the class but not outside the class.

To make protected members there is need to add double underscore prefix. They can be accessed from within the class or within the sub class.