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,

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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!