Path: utzoo!attcan!uunet!mcvax!ukc!its63b!db From: db@its63b.ed.ac.uk (D Berry) Newsgroups: comp.lang.c++ Subject: Pointers to functions as members Message-ID: <1340@its63b.ed.ac.uk> Date: 15 May 88 17:09:37 GMT Reply-To: db@itspna.ed.ac.uk (Dave Berry) Organization: University of Edinburgh Lines: 25 Is it possible to have a member of a class or struct which is a pointer to a function? I've tried the obvious syntax, but I couldn't get it to work. If not, why not? I don't understand. (where's the tea? :-) If so, what is the correct syntax? I'm trying to write a menu package which associates pointers to functions with each entry in a menu. This seems the obvious way to do it. The 'squares' program provided with InterViews as an example program defines an enumerated type for each menu. Each menu has associated with it a unique subclass of the class MenuItem. Clicking on an entry calls a function which does a switch on the enumerated type. This works OK, but it seems cumbersome and difficult to update dynamically. Am I missing something? -- ------------------------------------------------------------------------------- "England has become ... an intolerant, rascist, homophobic, narrow-minded authoritarian rat hole run by vicious suburban-minded materialistic philistines" -- Hanif Kureishi ------------------------------------------------------------------------------- Dave Berry. db%lfcs.ed.ac.uk@nss.cs.ucl.ac.uk