![]() |
![]() |
![]() |
![]() |
![]() |
|
Once you have created a variable and have assigned an instance of the
Movie class to it, you can refer to the instance's
script, acting, and direction instance variables. To
refer to an instance variable, you join the name of the Movie
variable, via the field-selection operator, to the name of the instance
variable in which you are interested. Thus, m.script produces the
value of the script instance variable of the Movie instance
assigned to the variable named m.
Once you know how to refer to a Movie instance's instance variables,
you are free to assign values to those
instance variables, as well as to retrieve previously assigned values:
... m.script ... <-- Retrieve a value from the script instance variable m.script = 3; <-- Assign a new value to the script instance variable