delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/07/25/01:46:29.1

From: Damian Yerrick <Bullcr_pd_yerrick AT hotmail DOT comRemoveBullcr_p>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Pointer to a function in class?
Organization: Pin Eight Software http://pineight.8m.com/
Message-ID: <to9qnsgv3rvq44tgv55ghqc3984vrob2vs@4ax.com>
References: <8li587$566$1 AT nnrp1 DOT deja DOT com>
X-Newsreader: Forte Agent 1.7/32.534
MIME-Version: 1.0
Lines: 20
X-Trace: /Kkf2KrYqWmJXzNjZaPmY5rOnMprt1iyxwxF7i7XaT6mCQaNSmBQwd71UhL1//yzMb9eNpaO3IZU!luEwGY8pMGncAgYRgm8Pf2H/O7V9U4KQnSXzsppGwMkJ2QhRczgJk/v43tsgI13VVejf9Ml78fyT!Uh22
X-Complaints-To: abuse AT gte DOT net
X-Abuse-Info: Please be sure to forward a copy of ALL headers
X-Abuse-Info: Otherwise we will be unable to process your complaint properly
NNTP-Posting-Date: Tue, 25 Jul 2000 05:37:28 GMT
Distribution: world
Date: Tue, 25 Jul 2000 05:37:28 GMT
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

On Mon, 24 Jul 2000 19:26:04 GMT, sami3079 AT my-deja DOT com wrote:

>How do I get a pointer to a function in class?

To be able to get pointers to class methods in C++, generally you have
to mark the function pointed to as "static" in the class declaration,
which means it doesn't get passed a pointer to `this'.

Seriously, pointers to methods aren't useful unless you're trying to
interface your C++ code with a library written in C (e.g. Allegro or
something).  If you're trying to interface C++ with C++, inheritance
and polymorphism (the `virtual' keyword) provide a cleaner mechanism.

-- 
Damian Yerrick
"I refuse to listen to those who refuse to listen to reason."
See the whole sig: http://www.rose-hulman.edu/~yerricde/sig.html

This is McAfee VirusScan. Add these two lines to your signature to
prevent the spread of signature viruses.  http://www.mcafee.com/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019