![]() |
![]() |
![]() |
![]() |
![]() |
|
With the RatingServer class defined, if only you had access to an
instance of that class, and did not mind running
serverRating on your own computer, you could substitute
serverRating wherever your program would otherwise use the
rating method defined in the Movie class.
For example, the observer defined in Segment 988 uses the
rating method, so you could make the following substitution, with
serverRating replacing rating.
// Replaced // row.add(new Integer(movie.rating())); // Substituted in row.add(new Integer((new RatingServer()).serverRating(movie)));