[Newbies] About methods and parameters
Delyan Kalchev
delyank at gmail.com
Wed Dec 3 09:23:23 UTC 2008
I have several questions:
1. As I see parameter passing in Smalltalk is always
call-by-reference, so within a method it is possible to do any
"destructive" actions over the passed object. Is there a way to
pass/accept a parameter as "const" so that it won't be changed in the
method.
2. When we pass an object to a method, it can do anything with it, but
is there a way to pass a variabe by reference and do change the passed
variable. For example:
i := 5.
MyObj method: i.
How can i be 6 after the method call.
3. Is there a way to pass a method as a parameter to another method.
Thanks.
--
Delyan Kalchev
More information about the Beginners
mailing list