Never mind, I had a typo in the code. I'll leave the content in case it helps others, but this is a solved topic. Mods feel free to delete.
This is basic C++, but I'm drawing a blank and not finding much luck with searches. I have a parent class that has a reset function (DecodeOOK.reset). I am inheriting this class into a child class and want to have a reset function there too (blueline.reset). What I want to do is call the function from the child to reset child specific values and then have that function call the parent reset to finish things off. What is the correct way to call this? My actual code is:
parent header
class DecodeOOK {
protected:
byte total_bits, bits, flip, state, pos, data[25];
virtual char decode (word width) =0;
public:
void resetDecoder () {
total_bits = bits = pos = flip = 0;
state = UNKNOWN;
}
};
child header:
class Blueline : public DecodeOOK {
protected:
uint8_t pulseState;
public:
void resetDecoder () {
pulseState=0;
DecodeOOK::resetDecoder;
}
};
ino
#include "DecodeOOK.h"
#include "Blueline.h"
Blueline blueline;
...
blueline.resetDecoder;
This one call to "blueline.reset" should reset both, but I'm not sure where to put what to make the parent's reset function fire.
I found a Stack Overflow topic with the exact same question, but when implemented it doesn't work so I don't know if this is my code or a difference between C++ and Arduino.