+ 3

In general class members are public.Which members are private?

Which members are protected ? Which members are hidden ?

10th Jul 2020, 9:34 AM
Rajan K
Rajan K - avatar
4 Réponses
+ 3
There is no privacy in Python. The only and common way is to 'tell' users to not use something by starting the name with _.
10th Jul 2020, 10:35 AM
HonFu
HonFu - avatar
+ 3
There is no privacy in python ✓✓✓
10th Jul 2020, 10:40 AM
Rajan K
Rajan K - avatar
+ 3
class C: a = 1 _b = 2 _b is not private, but the user knows they are not supposed to access _b.
10th Jul 2020, 10:40 AM
HonFu
HonFu - avatar
+ 1
I couldn't get it
10th Jul 2020, 10:39 AM
Rajan K
Rajan K - avatar