Home Segments Top Top Previous Next

291: Mainline

Suppose that you want to define for the Movie class a constructor that takes four arguments: the familiar script, acting, and direction values, plus the length of the movie in minutes. You want to use the constructor to create new Movie instances as follows:

            *-- Ratings for script, acting, and direction 
            | 
            |       *-- Length 
            v       | 
          -------   v 
new Movie(4, 7, 3, 88)  

The fourth argument establishes the value of the minutes instance variable inherited from the Attraction class.