RE: [Dev-C++] functionpointers within a class
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: Ramana K. <ra...@my...> - 2002-09-05 13:21:51
|
create your pointer like this: void (* funcPtr) ();
void is the return type, in the () is contained the arguments.
you then assign the pointer like: funcPtr = MyFunction;
then call it like: funcPtr();
you should be able to create this pointer as a private (or public) member
data, and assign it in member function code, or other function code.
-----Original Message-----
From: dev...@li...
[mailto:dev...@li...]On Behalf Of Stein Nygård
Sent: Thursday, 5 September 2002 2:07 AM
To: DevCpp
Subject: [Dev-C++] functionpointers within a class
Hi!
I'm having some trouble, with my pointers...
I would like to make a class, and it should contain several functions and
a pointer which will point at any of these functions. All functions would be
of type void ;) The functions must be able to set the value of the pointer,
to any of the other functions... making sense? Sure hope so!
any help? Thanks!
Stein Nygård - http://steinware.dk
lapido, ergo sum
|