私有
方法或者属性前加双下划线__
class Dog(Animal):
def __init__(self, x):
self.__x = x
def do_say(self):
print("Bhow Bhow!!")
def __do_say(self):
print("private method")
dog = Dog(1)
print(dog.__x)
dog.__do_say()
其中__x为私有属性,直接输出会报错Dog没有属性__x

__do_say为很私有方法,直接调用会报错
