Question: Complete the following code that constructs a Student class which is capable of storing the name, age, and gpa of a student. You also need
Complete the following code that constructs a Student class which is capable of storing the name, age, and gpa of a student. You also need to provide an appropriate constructor that will allow us to instantiate a Student object as follows: Student s(John, 18, 1.2);
class Student _________________________ {
protected: float _gpa;
1 mark
_____________________________________ public: Student(const string& name, int age, float gpa) :
Person(name, age), _gpa(gpa)
_____________________________________ {}
_____________________________________ _____________________________________ void print_info() { Person::print_info(); cout << "gpa = " << _gpa << endl;
} };
1 mark
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
