L 68: ACCESS MODIFIERS IN PYTHON | PUBLIC, PROTECTED, AND PRIVATE ACCESS SPECIFIERS IN PYTHON

Опубликовано: 12 Сентябрь 2024
на канале: Parnika Tutorials
814
23

In this video, I have discussed access modifiers in python

Social media Links:
Instagram:
Website: www.parnikatutorials.in
Email id: parnikatutorials
To get the regular updates:
Telegram link:
Facebook:
Linkedin:
Pinterest:

Playlists:
Virtual Coffee with Jagadeesh:
Digital Logic:
Computer Organization and Architecture:
C Programming:
Data Structures:
Theory of Computation:
Compiler Design:
Operating Systems:
Databases:
Computer Networks:
For GATE PYQs and much more explore:
Various object-oriented languages like C++, Java, Python control access modifications which are used to restrict access to the variables and methods of the class. Most programming languages has three forms of access modifiers, which are Public, Protected and Private in a class.
Python uses ‘_’ symbol to determine the access control for a specific data member or a member function of a class. Access specifiers in Python have an important role to play in securing data from unauthorized access and in preventing it from being exploited.
A Class in Python has three types of access modifiers:
Public Access Modifier
Protected Access Modifier
Private Access Modifier
Public Access Modifier:

The members of a class that are declared public are easily accessible from any part of the program. All data members and member functions of a class are public by default.
Protected Access Modifier:

The members of a class that are declared protected are only accessible to a class derived from it. Data members of a class are declared protected by adding a single underscore ‘_’ symbol before the data member of that class.

Private Access Modifier:

The members of a class that are declared private are accessible within the class only, private access modifier is the most secure access modifier. Data members of a class are declared private by adding a double underscore ‘__’ symbol before the data member of that class.