The first if statement enters as suspected. The object calls the getCount() function but the value that is incremented is not the previous count but instead 0. I tried using Count += Count in the function.
int main(){
.........
int displayCount;
while(!inputfile.eof())
{
inputfile.get(letter);
Checker object1;
if (object1.isValid(letter)))
{
displayCount = object1.getCount();
}
}
cout << displayCount;
.
.
.
Checker::Checker() :
m_Valid(false),
count(0)
{
}
int Checker::getCount()
{
if(m_Valid)
{
count ++;
}
return count;
}
My inclination is that once the value is returned from the function then thats it. It will no longer hold the previous value bc of this (my guess).