« Return to Thread: getter / setter questions
The interpretation of an assignment to a simple variable
x = e depends on thedefinition of
x. If x denotes a mutable variable, then the assignment changes thecurrent value of
x to be the result of evaluating the expression e. The type of e isexpected to conform to the type of
x. If x is a parameterless function defined insome template, and the same template contains a setter function
x_= as member,then the assignment
x = e is interpreted as the invocation x_=(e ) of that setterfunction. Analogously, an assignment
f .x = e to a parameterless function x isinterpreted as the invocation
f .x_=(e ).Am Wednesday 08 July 2009 11:16:41 schrieb Ricky Clarkson:
> I think it's reasonably obvious that bar isn't the name of a setter fora setter can be just some function, like written here:
> foo.
on page 392 and 393 of the "Programming in Scala" book there is an example
where they define conversion functions to and from fahrenheit to and from
celsius with a getter and a setter function. This looked to me like I can
choose the names for getters and setters arbitray. But maybe just my english
sucks and I understood something which isn't there :-)
cheers
Michael
« Return to Thread: getter / setter questions
| Free embeddable forum powered by Nabble | Forum Help |