I have a class. In method "Complete" i want to make a new instance of this class and add it to the array. But instead it just adds my current instance to the array. How can i create a new instance by using this method?
class Task:
ArrPosition = 0
def __init__(self, content, state, arr):
self.content = content
self.state = state
self.arr = arr
def Complete(self, Answer, CurrentPosition):
if Answer == "True":
self.state = "True"
self.ArrPosition += 1
if self.ArrPosition < 4:
SessionArray[CurrentPosition + self.arr[self.ArrPosition]].append(Task(self.content, "NULL", [0,2,6,10]))
if Answer == "False":
self.state = "True"
self.ArrPosition = 0
SessionArray[CurrentPosition + 1].append(Task(self.content, "NULL", [0,2,6,10]))
Other examples show how to do that outside of the class description, but i need to do that inside.