Question: Define a class called Person that contains a private variable name, a constructor that takes in a name, and a function void printDetails() that prints

Define a class called Person that contains a private variable name, a constructor that takes in a name, and a function void printDetails() that prints the name of the Person. Implement printDetails. ii. Define a class called Student that inherits from Person. A Student has a name and an id, and a constructor that takes in a name and an id. Add a function printDetails() to Student which prints out the name and the id of the Student. Implement printDetails. iii. What is required to ensure that the following code fragment outputs the correct information: Person student = Student("John Smith", "al234567"): student printDetails()
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
