Files

61 lines
975 B
C
Raw Permalink Normal View History

2025-11-17 10:28:09 +01:00
#include <stdio.h>
class someClass{
char * value = "someValue";
}
class callback{
constructor() {
this->testCallbacks();
}
void callCallback( void ( * function )( struct someClass * caller, int ) , int number, struct someClass * caller ) {
function( caller, number );
}
void printTest( struct someClass * caller, int a ) {
printf("print test: %i %s .\n\n\n\n", a, caller->value);
}
void anotherPrintTest( struct someClass * caller, int a ) {
//struct user * someUser = someObject;
printf("another print test: %i %s .\n\n\n\n", a, caller->value);
}
void testCallbacks() {
someClass * instance = new someClass();
this->callCallback( this->printTest, 1234, instance );
this->callCallback( this->printTest, 5678, instance );
this->callCallback( this->printTest, 910, instance );
this->callCallback( this->anotherPrintTest, 910, instance );
this->callCallback( this->anotherPrintTest, 910, instance );
}
}