If I'm reading you correctly you mean that the class variables for freq etc. aren't being changed? This is because you never assign them. If you print them out inside the constructor, you aren't printing out the freq, a or b that belong to that object, you are printing out the values you passed in. Since you have local variables hiding the names of the class variables, you need to use the
this pointer to assign to the class variables.
this->freq is a variable belonging to the object under construction.
freq is a variable that you have passed into the constructor, modifying it will have no effect on the object.
Code:
Seti::Seti(const char rawData[ ], int freq, int a, int b){
cout << "in specific Seti constructor!" << endl;
if((freq >= 0 || freq <= 9) && ((a >= 0 || a <= 255) && (b >= 0 || b <= 255))) {
// if this is where you want to assign them
this->freq = freq;
this->a = a;
this->b = b;
result = analyze(rawData, signal, freq, a, b);
}
else{
this->freq = 0;
this->a = 0;
this->b = 0;
}
}
Does that help? Notice the
this-> in the else clause as well.