I changed that and I get all of these errors
39:9: error: expected unqualified-id before 'int'
39:9: error: expected ')' before 'int'
In function 'int main()':
52:74: error: no matching function for call to 'UndergradStudent::UndergradStudent(int, int, double, int, double)'
52:74: note: candidates are:
33:8: note: UndergradStudent::UndergradStudent()
33:8: note: candidate expects 0 arguments, 5 provided
33:8: note: constexpr UndergradStudent::UndergradStudent(const UndergradStudent&)
33:8: note: candidate expects 1 argument, 5 provided
33:8: note: constexpr UndergradStudent::UndergradStudent(UndergradStudent&&)
33:8: note: candidate expects 1 argument, 5 provided
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58
|
#ifndef Student_H
#define Student_H
#ifndef UndergradStudent_H
#define UndergradStudent_H
#include <iostream>
using namespace std;
class Student
{
protected:
int ID;
float mathScore;
float chemScore;
public:
Student (int = 0, float = 0.0f, float = 0.0f);
void getGPA();
};
Student::Student (int id, float ms, float cs)
{
ID = id;
mathScore = ms;
chemScore = cs;
}
void Student::getGPA ()
{
float gpa = (mathScore + chemScore)/2.0;
cout << "ID = " << ID << " PGA = " << gpa << endl;
#endif
}
class UndergradStudent::public Student
{
protected:
float engScore;
float bioScore;
public:
Student(int id = 0, float = 0.0f, float = 0.0f) : Student(id), mathScore(ms), chemScore(cs) {}
void getGPA();
};
void UndergradStudent::getGPA ()
{
float gpa = (mathScore + chemScore + engScore + bioScore)/4.0;
cout << "ID = " << ID << " PGA = " << gpa << endl;
}
#endif
int main()
{
Student student = Student(777,70.5,99.8);
UndergradStudent undergradStudent = UndergradStudent(999,80,55.6,70,44.9);
student.getGPA();
undergradStudent.getGPA();
return 0;
}
|