Roland Pibinger wrote, On 22/02/07 20:18:
On 20 Feb 2007 04:04:16 -0800, "subramanian100in@...com, India" wrote:
>Can a structure contain function pointers as members ?
If so, where is it useful ?
The following article may give some ideas. It is not perfect and may
be improved but it shows one way to program polymorphically in C:
http://www.codeproject.com/cpp/PolymorphismC.asp
It certainly needs some work. It uses a macro name which is an
underscore followed by a capital in the header, and such names are
reserved for the implementation. It uses the form
type *ptr = (type *)malloc(sizeof(type));
instead of the simpler and more robust
type *ptr = (type *)malloc(sizeof(type));
Also not specifying in prototypes when functions do not take parameters.
I've not actually downloaded the code to check the rest of it.
--
Flash Gordon