何が起こっているのですか?私はスタックオーバーフローで他のソリューションを見てきましたが、私が見たものではうまくいかないようです。私は基本属性の値を変更するメソッドを持つ基本オブジェクトを持っています。 謝罪、私はもともと自己に渡されたことがない:私は子クラス(継承)で基本関数を呼び出すとき、私は子供のクラスは、属性「baseAttribute」子クラスのPythonで基本クラスメソッドを呼び出す
class GameObject(object):
#This is the base class for gameObjects
def __init__(self):
self.components = {}
def addComponent(self, comp):
self.components[0] = comp #ignore the index. Placed 0 just for illustration
class Circle(GameObject):
#circle game object
def __init__(self):
super(GameObject,self).__init__()
#PROBLEM STATEMENT
self.addComponent(AComponentObject())
#or super(GameObject,self).addComponent(self,AComponentObject())
#or GameObject.addComponent(self, AComponentObject())
EDITを持っていないことを取得します。
私は驚くべきことを認めています;-) – GhostCat