How to attribute something strongly private | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How to attribute something strongly private

attribute strongly private and access it from outside of the class.

19th Jun 2020, 5:23 AM
Patricia Silva
Patricia Silva - avatar
1 Answer
0
In Python there is not such thing as making attributes private or protected. Everything can be accessed from outside the class. The only thing closest to that is that you can name the attributes differently and Python then gives them a different name. See this for reference https://code.sololearn.com/cblWIvG9yBOj/?ref=app Although the attribute name was __name, Python stored it as _Hello__name. This is the closest you can get to making something private. See this also https://www.sololearn.com/learn/Python/2471/
19th Jun 2020, 5:59 AM
XXX
XXX - avatar