Looking pretty good so far. A few comments, though.
First, class declarations end with
};
not just
}
so update line 36 accordingly!
It looks like you want to use a string variable for 'color'. That's fine, but I would put
#include <string>
at the very top of the file. Also, on lines 12, 19, 24, and 31 I would say
std::string
instead of just
string
. You could also say
using namespace std;
above your class declaration instead, but I prefer to qualify the types individually. If you don't do this, the compiler is not going to know what
string
is when you build your code.
I don't see a declaration for
A utility function that increments the value of Number of Modifications by 1, and it should be called each time a set function is used. When the user calls the set all function, the attribute Number of Modifications should not be incremented. Number of Modifications can only be incremented if the attribute’s set function is called directly by the user and the new value should be different from the old value. |
I'd stick this under the
private:
section of your class since it is only going to be called internally (i.e. only by your other class functions, never directly from main()) And you'll probably want to pass in some indicator of whether or not it was called from an individual set or the set all method.
void incrementModificationCounter(bool calledFromSetAll);