Overload inherited class function (never mind...typo)


never mind, had typo in code.  i'll leave content in case helps others, solved topic.  mods feel free delete.



this basic c++, i'm drawing blank , not finding luck searches.  i have parent class has reset function (decodeook.reset).  i inheriting class child class , want have reset function there (blueline.reset).  what want call function child reset child specific values , have function call parent reset finish things off.  what correct way call this?  my actual code is:

parent header
code: [select]
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:
code: [select]
class blueline : public decodeook {
protected:
    uint8_t  pulsestate;
public:
    void resetdecoder () {
        pulsestate=0;
        decodeook::resetdecoder;
    }
};


ino
code: [select]
#include "decodeook.h"
#include "blueline.h"

blueline blueline;
...
blueline.resetdecoder;


this 1 call "blueline.reset" should reset both, i'm not sure put make parent's reset function fire.

i found stack overflow topic exact same question, when implemented doesn't work don't know if code or difference between c++ , arduino.



Arduino Forum > Using Arduino > Programming Questions > Overload inherited class function (never mind...typo)


arduino

Comments