www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1994/12/03/01:18:04

Subject: Pointers to Functions in c++
From: WU DAVID S <wudavid AT ecf DOT toronto DOT edu>
To: djgpp AT sun DOT soe DOT clarkson DOT edu
Date: Fri, 2 Dec 1994 10:15:49 -0500

I was wondering if anyone knew a good method to pass member functions
to something.

if I want to develop a generic list of pointers to functions, that say draw_me();
is there any way to do this?
What I am doing know is this,
the list stores two things, the address of the of member (a s a void)
and an integer identifier.
e.g. to call, 

switch (ID)
case BOX : ( (box *)dummyPointer)->draw(); breajk
case CIRCLE : ( (circle *)dummyPointer)->draw(); break;
etc.

I have heard that C++ functions are just liked dos functions in which the
first parameter is "this" is this always the case?  Is there a way to
take advantage of this?

-- 
                                          |\___
                                          |O.o/
          David Wu                       =(___)=    Don't Drink
                                            U       and Derive

Disclaimer:  This message may not be politically correct.
The message may not be grammatically correct.

- Raw text -


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