Write a base class (Person) that has the following data members: String name, long NID, int age. Your class (Person) should have setters and getters for all data members. Derive a class (Student) from class (Person). Class student should have the following private data members: Int id, double GPA, string major. Class (Student) should have setters and getters for its private data members. In your main function, create an object of class (Student) and set all of its data members.

C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter12: Adding Functionality To Your Classes
Section12.2: Providing Class Conversion Capabilities
Problem 2E
icon
Related questions
Question
  1. Write a base class (Person) that has the following data members:
  • String name, long NID, int age.

Your class (Person) should have setters and getters for all data members.

  1. Derive a class (Student) from class (Person). Class student should have the following private data members:
    • Int id, double GPA, string major.

Class (Student) should have setters and getters for its private data members.

  1. In your main function, create an object of class (Student) and set all of its data members.
Expert Solution
steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Knowledge Booster
Reference Types in Function
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr