So I started to develope an OpenCV program and the thing is that I don't know what this segment of code do in the whole context. Below is an abstract version of the whole code.
class foo{
private:
    friend void callBack(void *param);
    void draw(void);
public:
    void func(void);
    void update(void);
}
void callBack(void *param){
    foo *context = static_cast<foo*>(param);
    if(context){
        context->draw();
    }
}
foo::foo(std::string windowName){
    cv::namedWindow(windowName, frameSize.width, frameSize.height);
    cv::resizeWindow(windowName, frameSize.width, frameSize.height);
    cv::setOpenGlContext(windowName);
    cv::setOpenGlDrawCallback(windowName, callBack, this);
}
void foo::func(void){
    cv::updateWindow(m_windowName);
}
void draw(void){
    //implementation shows here!!
}
You don't have to explain all the code here. All I need to know is the part where static casting happens. What does it do? Why does a person who implements the code write it this way?
 
     
     
    