Skip to main content

Recap—Advanced Class Definition

That's enough class definition for now. Before we move on to creating the home page for our application, let's recap what we've done. We've made the following changes to Film:

  • Added a property named Rating that accepts a limited set of predefined values, which we defined using the VALUELIST datatype parameter. generated description: smallbacktriangle.gif

  • Added a property named Length that records the duration of each film. This data is stored as an integer representing the length in minutes but displayed in hours and minutes form, that is, 1h42m. Because we might want to reuse this functionality, we implemented it by creating a new data type called Duration. Duration is a subclass of the standard %IntegerOpens in a new tab class. It overrides %IntegerOpens in a new tab's LogicalToDisplay method, but otherwise inherits the rest of %IntegerOpens in a new tab's behavior. generated description: smallbacktriangle.gif

  • Added a Category property that records the genre for a film. Because our list of genres may change, we created a separate FilmCategory class whose instances represent individual film genres. Film's Category property is, then, of type FilmCategory. generated description: smallbacktriangle.gif

FeedbackOpens in a new tab