![]() |
Attention | Topic was automatically imported from the old Question2Answer platform. |
![]() |
Asked By | psear |
I have something like this
class ParentClass:
var a : array
func do_something():
a.append(something)
a.something_else()
class ChildClass inherits ParentClass:
var a = [1,2,3]
I want to have a child class define the variables for the parent class that it extends, but gdscript throws an error saying that the parent class already has that member variable defined. I’m aware something could be done using init but I wanted to avoid having to use that if possible and just have my variables defined. Is there any other simple way to accomplish what I’m trying to do?
Have you tried not defining it in the child class, i.e. just put a = [1,2,3]
(remove the var
)
SteveSmith | 2022-10-10 19:40