무슨 일이 일어나고있는 중입니다. 스택 오버플로에 대한 다른 솔루션을 살펴 보았지만 비 보았습니다. 기본 속성의 값을 변경하는 메소드가있는 기본 객체가 있습니다. 사과, 내가 원래 자체에 전달되지 않는다 : 나는 아이 클래스 (상속)에서 기본 함수를 호출 할 때 나는 자식 클래스는 속성 "baseAttribute"하위 클래스 파이썬에서 기본 클래스 메서드 호출
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())
편집이 없음을 얻는다.
놀랍도록 받아 들일 만합니다 ;-) – GhostCat