Hi to alll, I want to know when I have call by value and when call by reference.
For Example I have these four classes
Generator := class():
var Counter: float = 0.0
CountUp():void=
set Counter += 1
GetCounter():float=
return Counter
Meow := class():
SingleGenerator : Generator = Generator{}
MainCounter : float = 0.0
Init():void =
Generator.CountUp()
set MainCounter = Generator.GetCounter() # Not working as it is not a var MainCounter
MakeMeowClass<constructor>(GeneratorConstructor:Generator, MainCounterConstructor:float) := Meow :
SingleGenerator := GeneratorConstructor
MainCounter := MainCounterConstructor
Test := class():
MainCounter : float = 0.0
MakeTestClass<constructor>(MainCounterConstructor:float) := Test :
MainCounter := MainCounterConstructor
Manager := class()
var Generator : Generator = Generator{}
var MainCounter : float = 0.0
Initiate():void =
set Meow = MakeMeowClass(Generator, MainCounter)
If I put in the Manager Constructor my Generator object found out that I have a call by reference, but the MainCounter is only call by value. How can I have a reference in the Meow class? Do I have to create a seperat class only for the MainCounter with functions such as Increase(value:float) or Decrease(value:float)? Is that event correct that I have a call by reference for the Generator inside the constructor?
I just want that the values of the MainCounter in the Test class and Meow class should be the same (just a reference) if I change it in one class