Home Segments Top Top Previous Next

300: Mainline

You can arrange for the one-parameter constructors in the Movie and Symphony classes to call the one-parameter Attraction constructor, shown, for example, in Segment 299. Ordinarily, all constructors call only the zero-parameter constructor in the direct superclass.

Whenever you want a constructor to hand one or more arguments to another constructor in the direct superclass, you modify the constructor's definition by adding, as the first statement in that constructor, a statement consisting of the super keyword followed by an argument list.