|
Are both variables and methods inherited? A good answer might be:Yes---the method show in the superclass VideoTape is inherited in the subclass Movie. | |
Using a Super Class' ConstructorThe class definition for VideoTape has a constructor that initializes the member data of VideoTape objects. The class Movie has a constructor that initializes the data of Movie objects. The constructor for class Movie looks like this:
The statement super( ttl, lngth ) invokes the super class' constructor to initialize some of the data. Then the next two statements (on one line) initialize the members that only Movie has. When super is used in this way, it must be the first statement in the subclass' constructor. | |
QUESTION 9:Why is it called super? Click Here after you have answered the question |