Garmaine Staff asked 2 years ago

Is there a way to get the class object in a class static function other than passing it as function argument? I cannot pass it as argument or make my class singleton.

class test{
    int i=10;
    Static test_static_method(){
        // somehow get an object of the class to call class member.
        std::cout << classObj->i << "\n";

I am trying to pass the static function to a C-API that takes in void(*)(). But I need class instance in my function to access the class data. Any help is appreciated.