+ 2
class __object
then the class will be private?
2 ответов
+ 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
+ 3
Maninder Singh very good answer! thanks