In C, call-backs are done by passing function pointers, as you suggest. In C++, the C approach works, but is not recommended, as it is not object-oriented.
In C++ and Java, it is better to define a call-back interface and then to pass an object implementing that call-back interface. That's the more object-oriented way.
Betty Rubble? Well, I would go with Betty... but I'd be thinking of Wilma.
posted 12 years ago
thanks peter, but can you explain it in a bit detail.
well, one more thing confusing is taht, in c we tell exactly which function is to call by telling its pointer, but the way you are telling is telling the object. now we have to explicitly call the specified function from that class, isn't it so?
i have seen a call back method type api in winPCap api, which is used to analyze the network trafic. how may they have implemented things?
The difference between <b>failure</b> and <b>success</b> is often being <b>right</b> and being <b>exactly right</b>.