2 Oct
2009
2 Oct
'09
3:38 a.m.
Hi All, I was doing some work and created some bugs that I ironed out when I discovered something: when non-primitive types are passed to functions they are passed by reference and not by value! I include a test so you can see what I mean. I hope somebody find this useful. --art class test{ 0 => int val; } test obj1; // obj2 is a reference to obj1 test obj2 @=> obj1; <<< obj1.val , "original object">>>; <<< obj2.val , "reference to original">>>; 2 => obj2.val; <<< obj1.val , "original object">>>; <<< obj2.val , "reference to original">>>; fun void testclasspassing(test i) { <<< i.val, "in function" >>>; } testclasspassing(obj1); testclasspassing(obj2);