beyondgrader.com Logo
DemoBrowseAboutTeamLogin

Simple Person Inheritance

Geoffrey Challen // 2020.9.0

Create a class called Student that inherits from a class called Person. (Do not create Person. It is already available.) Define a single Student constructor that takes a String? argument (name) and an Int argument (university ID number). You should call the Person constructor and pass that String argument. (You don't need to do anything else with it.) You should also provide a public getter named getID for the student ID. Reject negative ID numbers using require.