Re: [Vala] Question regarding passing a strings as arguments to a method



Strings are passed by value. To avoid this use "unowned" keyword.
11.07.2011 1:36 пользователь "Serge Hulne" <serge hulne gmail com> написал:
The Vala tutorial says:
"*Parameter Directions* **

*A method in Vala is passed zero or more arguments. The default behaviour
when a method is called is as follows: *

- *Any value type parameters are copied to a location local to the method
as it executes. *
- *Any reference type parameters are not copied, instead just a reference
to them is passed to the method. *

*This behaviour can be changed with the modifiers 'ref' and 'out'.* "


*My question therefore is:*

- are strings passed by value or by reference to methods (by default).
- is it possible to pass a string by reference to a method (to avoid
duplication)

Serge.


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]