Mail Archives: djgpp/1998/09/22/07:54:09
>Is this possible?
>for example here's a class:
>
>////////////
>class CLS
>{
>public:
>int x,y;
>.....
>void OnMouseClick(void);
>};
>////////////
>
>Can I assign other function to a method? Something like:
>
>////////////
>void MyFunc()
>{
>.....
>}
>
>CLS object;
>object.OnMouseClick = MyFunc(); (?)
>////////////
>
No you can't. But you can have a pointer to a function that is called inside
OnMouseClick
ex.
class Object {
public:
int x, y;
...
void OnMouseClick(void) { &click_callback; }
void (*click_callback)(void);
};
void MyFunc()
{
...
}
Object object;
object.click_callback = MyFunc();
>
>
>
>
- Raw text -