Prev | Current Page 229 | Next

L. McColl-Sylvester and F. Ponticelli

"Professional haXe and Neko"


The syntax for a modified variable is the one shown in Figure 5 - 4 .
??‘
??‘
(continued)
private var name(getModifier, setModifier) : Type;
access
modifier
variable
name
get value
modifier
set value
modifier
variable
type
Figure 5-4
The access modifiers have the same behavior as already explained for functions. The Type is the kind of
value that the property can manage.
111
Chapter 5: Delving Into Object-Oriented Programming
Table 5-1
Variable Value Modifier Description
null The access is forbidden. Used in the getKeyword place, it means that
the variable is accessible just for writing; using it in the setKeyword
renders the variable read-only. Even if no errors are reported, having
null in both positions makes no sense.
default The variable is treated as a conventional variable. Declaring it with
default in both getKeyword and setKeyword positions, is exactly the
same as having an instance variable, but can enforce the semantic that
the access modifier may need to be changed in the future.


Pages:
217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241