Created
July 16, 2019 07:32
-
-
Save Warwolt/c7af04cf968723e68dcae9d0ca6c62fa to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Counter | |
{ | |
public: | |
void count() { counter++; } | |
int getCount() { return counter; } | |
private: | |
int counter = 0; | |
}; | |
static void(*funcptr)(void) = nullptr; | |
static Counter myCounter; | |
void interrupt_handler() | |
{ | |
if(funcptr != nullptr) | |
{ | |
funcptr(); | |
} | |
} | |
int main() | |
{ | |
funcptr = []{ myCounter.count(); }; | |
interrupt_handler(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment