Path: utzoo!attcan!uunet!samsung!zaphod.mps.ohio-state.edu!sunybcs!uhura.cc.rochester.edu!rochester!kodak!ektools!randolph From: randolph@ektools.UUCP (Gary L. Randolph) Newsgroups: comp.lang.c++ Subject: Re: pointers to methods Message-ID: <2435@ektools.UUCP> Date: 12 Feb 90 16:14:22 GMT References: <3063@pur-phy> Sender: randolph@ektools (Gary L. Randolph) Reply-To: randolph@ektools.UUCP (Gary L. Randolph) Organization: Eastman Kodak, Dept. 47, Rochester NY Lines: 40 In article <3063@pur-phy> sho@maxwell.physics.purdue.edu.UUCP (Sho Kuwamoto) writes: *I'm not up on 2.0 (did Stroustrup come out with a book yet? I haven't He is doing his best to meet this year's deadline. *been paying much attention to this group lately) but is there any *standard way you can get a pointer to a member function? How does it *work? I want something like this: * funcPtr = className::func; * instance->funcPtr(arg1, arg2); Not a problem. The definition of funcPtr will look like: retType (className::*funcPtr)(argType, argType); Then the actual call: instance->*funcPtr(arg1,arg2); This is documented in Lippman, pg. 213 and in 1988 USENIX proceedings pg. 305. *Now for the big finale. I'd like something like this, but one which works *for virtual functions. Also possible. See USENIX '88 referenced above. *TaDaa! Another pipe dream. This would give me more faith that C++ *was an object oriented programming language, with messages being *passed around, so forth. As it is now, I can't shake the feeling that *it's just a big program that mangles names for you. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ It is, if you don't know how to use it. Gary These views are mine and are not meant to represent views of the Eastman Kodak Company.