Careful with your use of terminology -- you are not using multiple inheritance; this is when one class has two or more base classes, e.g.
1 2
|
class AmphibiousVehicle : public Car, public Boat {
// etc.
|
(prob. not such a hot example, but you get the point?!)
What you have is multiple levels of single inheritance.
Anyway...
Your main problem is that you are inadvertently using private inheritance. You should be using public inheritance. e.g.
1 2
|
class PassFailActivity : public GradedActivity { // public before base class name
// etc
|
Almost all inheritance should be public -- private and protected inheritance have their place, but not for this kind of situation.
Changing all your derived classes to use public inheritance fixes the problem with setScore() but exposes several other errors:
1. getLettergrade doesn't exist
2. PassFailActivity::getMinPassingScore doesn't take zero arguments
3. PassFailExam::getNumQuestions isn't returning a value
4. ...
But these are you problems!
Andy
PS It is better form to use the constructor initializer list to initialize member variables:
1 2 3 4 5 6 7
|
PassFailExam::PassFailExam() : numQuestions(0), pointsEach(0.0), numMissed(0) // init here
{
// rather than here!
//this->numQuestions = 0;
//this->pointsEach = 0.0;
//this->numMissed = 0;
}
|
Not such a big deal for built-in types, but can be important for class members.