3 ms·
That’s not their purpose and they’re not really private. Leading double underscore methods cause name mangling (the class name gets added to the method name) an
by travisjungroth 6y ago
That’s not their purpose and they’re not really private. Leading double underscore methods cause name mangling (the class name gets added to the method name) and they’re used for solving specific problems with inheritance. Don’t use them just to make something private. You’re screwing up your inheritance if you don’t realize what you’re doing.
Leading single underscore is private by convention. Still should generally be avoided, but it’s the proper use.