+ 2

class __object

then the class will be private?

22nd Apr 2018, 8:55 AM
ManYin Cheung
ManYin Cheung - avatar
2 Answers
+ 5
This is not private its just convention you can access these attributes of the class before write the class name.e.g= class Car: def__init__(self,colour): self.__colour=colour x=Car('red') print(x._Car__colour)#output=red print(x.__colour)#output=error
22nd Apr 2018, 9:33 AM
Maninder $ingh
Maninder $ingh - avatar
+ 3
Maninder Singh very good answer! thanks
22nd Apr 2018, 10:12 AM
Oma Falk
Oma Falk - avatar