gas@cs.nott.ac.uk (Alan Shepherd) (05/29/90)
I'm trying to use a structure containing a char* (name of type) and a
pointer to a member function. The structure looks like:
typedef struct _parseinfo {
char *name;
Boolean (Base::*proc)(const CString&);
} ParseInfo;
The class Base has a static member variable (ParseInfo lineTypes[])
which I initialise like so:
struct ParseInfo Base::lineTypes[] = {
{ "name", Base::Name },
{ "description", Base::Description },
..etc..
};
AT&T treats this ok unless one of the methods is overloaded in which
case it complains like mad. Should it do this ?
Secondly, it would be nice to use the same structure for a subclass of
base. Unfortunately, this seems not to be possible since the pointer
to function explicitly says Base::. A way round this is of course to
declare any subclass method which I want to use in this way as a
virtual method of Base, but this seems a bit a tacky. Anyone any
better ideas ?
G++ seems to treat static member variables in a different way
(possibly better !) but I haven't yet tracked down the differences.
However, for software compatibility I'm stuck with AT&T anyway.
Help appreciated.
Alan Shepherd.