home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!cs.utexas.edu!devnull!thunder.Berkeley.EDU!rjf
- From: rjf@thunder.Berkeley.EDU (Russell Fleming)
- Newsgroups: comp.lang.c++
- Subject: Re: pointer typecasting question...
- Message-ID: <2425@devnull.mpd.tandem.com>
- Date: 11 Sep 92 15:34:30 GMT
- References: <1992Sep10.210319.4450@news.columbia.edu>
- Sender: news@devnull.mpd.tandem.com
- Lines: 26
-
- In article <1992Sep10.210319.4450@news.columbia.edu>,
- kps@cunixb.cc.columbia.edu (Karthik P Sheka) writes:
- > I'm working on a C++ program that is using a C package that is giving
- > problems (The package was not meant to be used in C++):
- >
- > One C call I make, CreateButton, takes as an arguement, a pointer to a
- > function that takes one arguement and returns void:
-
- ... C example deleted ...
-
- > When used in a C++ program, I want to send a pointer to an instance of a
- > public function. Unfortunately, this does not work:
- >
- ... C++ example deleted ...
-
- This is a FAQ. Each function of a class (except for static functions)
- has an implied first argument which is a pointer to an instance of the
- object. Therefore, a function of a class which has a single int
- argument is really a function which has two arguments (a pointer to the
- object and an int). A stand-alone function which has a single int
- argument only has the single int argument.
-
- =================================================================
- Rusty Fleming, Software Consultant @ Tandem Computers Inc.
- email: rjf@mpd.tandem.com Austin, Texas
- voice: (512) 244 - 8390 USA
-