PART I
C h a p t e r 6 :
I n t r o d u c i n g C l a s s e s a n d O b j e c t s
119
PART IPART I
Next, look closely at this line of code from inside
Main( )
:
house.AreaPerPerson();
This statement invokes the
AreaPerPerson( )
method on
house
. That is, it calls
AreaPerPerson( )
relative to the object referred to by
house
, by use of the dot operator.
When a method is called, program control is transferred to the method. When the method
terminates, control is transferred back to the caller, and execution resumes with the line
of code following the call.
In this case, the call to
house.AreaPerPerson( )
displays the area-per-person of the
building defined by
house
. In similar fashion, the call to
Do'stlaringiz bilan baham: |