home *** CD-ROM | disk | FTP | other *** search
- Xref: sparky comp.sys.sgi:11615 comp.lang.c++:11757
- Newsgroups: comp.sys.sgi,comp.lang.c++
- Path: sparky!uunet!haven.umd.edu!darwin.sura.net!mips!odin!fido!shankar
- From: shankar@sgi.com (Shankar Unni)
- Subject: Re: C++ member pointer error
- Message-ID: <ntqlk2k@fido.asd.sgi.com>
- Sender: news@fido.asd.sgi.com (Usenet News Admin)
- Organization: Silicon Graphics, Inc.
- References: <1992Jul28.184745.2854@babbage.ece.uc.edu>
- Date: Wed, 29 Jul 1992 21:34:32 GMT
- Lines: 18
-
- In article <1992Jul28.184745.2854@babbage.ece.uc.edu> tmcbraye@snert.ece.uc.edu (Tim McBrayer) writes:
-
- > cout << (e.fn)(i) << endl; //ERROR: (*(e.fn))(i) gives the same error
- ^^^^^^
-
- A pointer-to-member-function *must* be called through an object of
- that class. In your example, "e.fn" must be called through an object
- of class "V". In the portion of the example, the most likely such
- object is the "this" of "V::run".
-
- Thus
-
- cout << (this->*(e.fn))(i) << endl;
-
- should do what you expect..
- --
- Shankar Unni E-Mail: shankar@sgi.com
- Silicon Graphics Inc. Phone: +1-415-390-2072
-