class Parent:
    def __init__(self):
        self._lst = []
class Child(Parent):
    def __init__(self):
        super().__init__()考虑到上面的代码,假设我想在子类中实现一个方法,是否允许对此方法使用self._lst (它是在父类中初始化的私有属性)?换句话说,是否允许我通过子类访问父类中初始化的私有属性?
https://stackoverflow.com/questions/73045559
复制相似问题