Function pointer wooes
-
How do i make a pointer to point to a function. and i hope to have this pointer to be able to point to several type of functions? like CString getDate(); CString getMonth(int i); how can make a pointer to point either to these two functions?? thanxs in advance
-
How do i make a pointer to point to a function. and i hope to have this pointer to be able to point to several type of functions? like CString getDate(); CString getMonth(int i); how can make a pointer to point either to these two functions?? thanxs in advance
aldeba wrote: how can make a pointer to point either to these two functions?? You can't. The signatures of functions are different - getDate doesn't have arguments, while getMonth takes one integer argument. Why would you like to have one pointer which can point to either of these functions? Tomasz Sowinski -- http://www.shooltz.com
What is "scratch" and why can everything be made from it?
-
How do i make a pointer to point to a function. and i hope to have this pointer to be able to point to several type of functions? like CString getDate(); CString getMonth(int i); how can make a pointer to point either to these two functions?? thanxs in advance
you can use a void * pointer to point at either function: void *p = getDate; p = getMonth; -c
WWJD? JWRTFM.
found on /. -
How do i make a pointer to point to a function. and i hope to have this pointer to be able to point to several type of functions? like CString getDate(); CString getMonth(int i); how can make a pointer to point either to these two functions?? thanxs in advance
just tak ein to a void pointer .after that cast them in to appropriate funtion type.. Renjith-CPian.