
For this question you have to type code in the textbox provided. You cannot attach a file as an answer.
NB: Do not use TAB when entering your code, rather use spaces to indent.
Use separate compilation to declare a class Voter as an ADT. Remember to include the necessary directives.
The class Voter has three member variables:
– ID (a string)
– nrTimesVoted (an int value)
– voted, a bool variable to indicate whether a voter has voted or not.
Provide only the class declaration (interface) for the class Voter.
The class Voter has the following member functions:
– A default constructor
– A destructor
– A mutator for the member variable voted
– An accessor for the member variable nrTimesVoted
– An overloaded equality operator == (implemented as a friend function) with the following prototype:
bool operator == (const Voter & V1, const Voter & V2)
This function returns true if V1’s ID is the same as V2’s ID and false otherwise.
– An overloaded stream extraction operator for the class Voter.
