![]() |
![]() |
![]() |
![]() |
![]() |
|
Once you have created a box_car object by defining a variable of the
box_car class, you can refer to that box_car's own
height, width, and length member variables. To refer
to a member variable, you join the name of the box_car variable, via
the
class-member operator,
a period, to the name of the member variable in which you are interested.
Thus, x.height produces the value of the height member
variable of the box_car object named by x.
Once you know how to refer to a box_car object's member variables,
you are free to assign values to those member variables and, subsequently,
to retrieve those values.