Say i have a variable in a general Global.as file like this:
public static const test:String = "testString";
And in another file i want to override that variable. like following perhaps:
In File1.as :
override var test:String = "testStringUpdated";
Ofcourse this isnt working. Does anyone know how to do this?
Is it actually possible with override and is override suposed to be used like this? Or is it only for overriding functions?
Thanks in advance.
Generally you don’t ‘override’ variables; simply change their value in the subclass (a constructor is a good place for this).
As for literally overriding, you can override setters and getters.
Simply set up your variable as a setter/getter combination in the base class, eg:
Then in your subclass (File1), you can alter how the value of
testwill be obtained, eg: