Hello I have an error of the derived class(IDscore.h) not having getscore as a member even though it should be since it is part of the testscore.h which is what idscore.h is derived from this error occurs in the scoretesting.cpp towards the end at getscore()
the other error i have is the ".what" imust have a class/struct/ union which i dont understand.
The other errors i get are in the TestScore.h where the TestScore and TestError are both giving me a class type redefinistion error when I already tried adding #indef and #endif but thAt didnt help.
I have edited this program without adding a derived class and it works fine so i would have assumed that adding a derived class would have been no difference but it is.
Here are the files i have and I can only change the Scoretesting,IDscore.h , idscore.cpp Thanks for any help
#include<string>
using std::string;
#include<iostream>
usingnamespace std;
#include<stdexcept>
using std::runtime_error;
class TestError : public runtime_error
{
public:
TestError(const string& msg):runtime_error(msg){}
};
class TestScore
{
public:
TestScore(constchar *in_name, int in_score);
TestScore(string in_name, int in_score);
string getName(void);
int getScore(void);
private:
string studentName;
int studentScore;
};
Always copy the exact errors that you get and paste them here.
fyi it runs fine here aside from your function call parameter order not matching the function definition:
How many students took the exam? 3
Enter student's name, ID number and score: John 1 90
Enter student's name, ID number and score: Jane 2 100
Enter student's name, ID number and score: Juan 42 95
90 : 1
100 : 2
95 : 42
____________________________________________
Test Average is : 15
If you are using an IDE, try cleaning your project.
Here are the errors.. i cleaned and also rebuild but i still get these errors...
Also which function call parameters are you referring to when you say they are not matching?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
Error 4 error C2228: left of '.what' must have class/struct/union h:\personal\visual studio 2012\projects\program13\program13\scoretesting.cpp 67 1 Program13
Error 5 error C2039: 'getScore' : is not a member of 'IDScore' h:\personal\visual studio 2012\projects\program13\program13\scoretesting.cpp 81 1 Program13
Error 6 error C2039: 'getScore' : is not a member of 'IDScore' h:\personal\visual studio 2012\projects\program13\program13\scoretesting.cpp 83 1 Program13
Error 3 error C2027: use of undefined type 'TestError' h:\personal\visual studio 2012\projects\program13\program13\scoretesting.cpp 67 1 Program13
Error 2 error C2011: 'TestScore' : 'class' type redefinition h:\personal\visual studio 2012\projects\program13\program13\testscore.h 26 1 Program13
Error 1 error C2011: 'TestError' : 'class' type redefinition h:\personal\visual studio 2012\projects\program13\program13\testscore.h 19 1 Program13