Hi, i created a header file and its .cpp file with the method definitons. On compile it gives me errors abt the declaration of increment, even though it is set to void
link to assignment:- http://www.cs.uh.edu/~svenkat/lib/as...r2003/ASSIGN1/
this is header file
Code:
class ModuloCounter //name of class
{
public:
ModuloCounter(int); //the constructor, will take mod value given by user
~ModuloCounter();//destructor, which will also take care of the number of counters
int getCounterValue();//returns counter value
int getCounterLimit();//returns counter limit
int getNumberofModuloCounters();//returns number of counters running
void increment();//increase counter value
void decrement();//decreases counter value
private:
int counterLim;//this is the mod limit set by the user
int counterVal;//counter value from 1 to counterLim
int moduloNum;//number of counters running
};//end of class
and here is the .cpp file
Code:
#include "ModuloCounter.h"
ModuloCounter::ModuloCounter(int set)
{
counterLim=set;
moduloNum++;
};
ModuloCounter::~ModuloCounter()
{
moduloNum--;
}
ModuloCounter::getCounterLimit()
{
return counterLim;
}
ModuloCounter::getCounterValue()
{
return counterVal;
}
ModuloCounter::getNumberofModuloCounters()
{
return moduloNum;
}
ModuloCounter::increment()
{
if(counterVal==counterLim)counterVal=1;
else
{
counterVal++;
}
}
ModuloCounter::decrement()
{
if(counterVal==1)counterVal=counterLim;
else
{
counterVal--;
}
}