Oh! So I was wrong maybe... But why does it works?
As example i'm passing TLog objects to functions as a value parameter... So when I call the procedure toLog(msg : string); it add the string correctly to the object by TStringList.Add and the Object itself is modified ...
I'm gonna read those ressources carefully !
Thanks !
Your code works as it should. There is nothing wrong in it.
The parameters can be passed to routine (function or procedure) as value parameters (that is "by value") or variable parameters ("by reference"). When we pass by value, then we can consider that when the routine is called, then a local variable is created in the routine and value of passed parameter is copied to this variable, so when we return from routine, the modified value of parameter (actually, only the value of this local variable in routine was modified) is lost, BUT if passed variable is a pointer (and note that object are pointers too), then this copied value is adress of referenced object and our new variable, with local scope in called routine holds the same adress (so, it points to same object in memory), doesn't it? Therefore, the actual object is same, even though we passed the pointer to it by value. Changes made in routine to referenced object are made to same object, because it was same adress got copied to local variable, so local variable points to same place in memory, to same object.
That is the reason your programme behaves this way. I hope this was not too confusing.
