我想在C文件中调用A文件中A这个类的add函数,A类继承父类X,add这个函数使用了父类的方法,C中实例化对象后调用add函数时报错
AttributeError: 'NoneType' object has no attribute '方法x'
应该怎么解决呢
同一个目录下A.py C.py两个文件
调用类:
A.py文件:
class A(classx):
def add(self):
self.x.方法x()
C.py文件:
from A import A
a=A()
a.add()
x没赋值啊,是None
你确定不是要调用self.方法x,而是要调用self.x.方法x吗