C++ calling a method outside a class from inside a class -


i have c++ program this:

class kbdrptparser : public keyboardreportparser {         void printkey(uint8_t mod, uint8_t key);  protected:         virtual void oncontrolkeyschanged(uint8_t before, uint8_t after);      virtual void onkeydown  (uint8_t mod, uint8_t key);     virtual void onkeyup    (uint8_t mod, uint8_t key);     virtual void onkeypressed(uint8_t key); };  //ommitted stuff here  void kbdrptparser::onkeypressed(uint8_t key) {     keypress(key);  };  void keypress(uint8_t key) {     //do stuff... }  //rest of program... 

i want able call keypress inside kbdrptparser::onkeypressed, because there global variables won't work if put code keypress kbdrptparser::onkeypressed. how can accomplish this?

you need declare before

void keypress(unit8_t key);

void kbdrptparser::onkeypressed(uint8_t key) {

}

personal suggestion, , follow pure object oriented way, declare keypress static function of class , global variables extern


Comments

Popular posts from this blog

user interface - How to replace the Python logo in a Tkinter-based Python GUI app? -

objective c - Greedy NSProgressIndicator Allocation -

how to set an OCR language in Google Drive -