1 つの継承からすべてのクラスを移動しようとしています。私はこの小さなスクリプトを書きました:
class c1:
def move():
x+=1
y+=1
class c2(c1):
y=1
x=2
c=c2
c.move()
print(str(c.x)+" , "+str(c.y))
私がそれを実行すると、次のようになります:
Traceback (most recent call last): File "/home/tor/Workspace/try.py", line 9, in <module>
c.move() TypeError: unbound method move() must be called with c2 instance as first argument (got nothing instead) [Finished in 0.1s
with exit code 1]
私は何を間違えましたか?