Mail Archives: djgpp/1997/08/22/08:33:55
Look, forget about c++ becuase really, underneath all of the fany object
rubbish are pointers to functions in structs.
Your problem lies with this sentence: "_Pointer_to_function_ in struct", ie.
you have said there is a POINTER to a function in the struct NOT a function.
So, as per an example that was sent as a response shows, you need to make
that pointer point to something before you can call it successfully.
Simple.
Jeff Weeks wrote in article <33FCDA5C DOT 2353659F AT execulink DOT com>...
>I'd like to have a function in a struct that I've created. I realise I
>can't just stick a functions in there, so I used a pointer to a
>function. Here's what my struct looks like:
>
>typedef struct {
> VesaInfo card; // information about the video card
> VesaModeInfo mode; // information about the current mode
> int bytes_per_line; // the number of bytes per scanline
> int size; // the size in bytes of the whole screen
> char *address; // the address of actual video memory
> void (*blit)(char *); // a routine to copy a virtual screen to
>memory
>} Driver;
>
<snip>
- Raw text -