Click here to Skip to main content
15,912,977 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralString field Pin
Anonymous1-Dec-03 2:37
Anonymous1-Dec-03 2:37 
GeneralRe: String field Pin
WREY1-Dec-03 2:58
WREY1-Dec-03 2:58 
GeneralRe: String field Pin
Anonymous1-Dec-03 5:04
Anonymous1-Dec-03 5:04 
GeneralRe: String field Pin
David Crow1-Dec-03 5:44
David Crow1-Dec-03 5:44 
GeneralRe: String field Pin
Anonymous1-Dec-03 9:24
Anonymous1-Dec-03 9:24 
GeneralRe: String field Pin
David Crow1-Dec-03 9:37
David Crow1-Dec-03 9:37 
Generalnews service for users over a network Pin
gina781-Dec-03 2:02
gina781-Dec-03 2:02 
GeneralMy array of "pointers to function" doesn't work. Pin
WREY1-Dec-03 1:48
WREY1-Dec-03 1:48 
There are several functions whose prototypes are the same. Because each is dependent on the preceding one to return a certain value, I thought, puttting them (the functions) in an array, and executing them from the array would be easier.

The syntax of the statements are correct, but when the program executes, the functions don't get activated.

Might someone see why this is happening? Here's the code.
class MyClass
{
   // other stuff
   enum PStatus { NoError, InvalidCode, OutOfRangeAmt, etc. };
   PStatus Func1();
   PStatus Func2();
   PStatus Func3();
};
================
later in the program, I do this.
...
PStatus PS = NoError;
const int n = 3;
typedef bool (MyClass::*PTF)();
PTF FuncArr[n] = { MyClass::Func1, MyClass::Func2, MyClass::Func3 };
...
for(int i=0; i<n && PS==NoError; ++i)
    FuncArr[i];
Even when I removed the "PS==NoError" part of the condition, the functions still didn't get activated.

Perhaps I should also mention, when I coded:
PS = FuncArr[i];
in the "for" statement, the compiler complained. (FWIW, I put certain message in each function to let me know they were entered. No such messages were shown.)

Thanks for any insight.

Unsure | :~

William

Fortes in fide et opere!
GeneralRe: My array of &quot;pointers to function&quot; doesn't work. Pin
Monty21-Dec-03 1:55
Monty21-Dec-03 1:55 
GeneralRe: My array of &quot;pointers to function&quot; doesn't work. Pin
WREY1-Dec-03 2:39
WREY1-Dec-03 2:39 
GeneralRe: My array of &quot;pointers to function&quot; doesn't work. Pin
Steen Krogsgaard1-Dec-03 3:06
Steen Krogsgaard1-Dec-03 3:06 
GeneralRe: My array of &quot;pointers to function&quot; doesn't work. Pin
GDavy1-Dec-03 3:30
GDavy1-Dec-03 3:30 
GeneralDevices Pin
DmitryR1-Dec-03 1:47
DmitryR1-Dec-03 1:47 
GeneralRe: Devices Pin
Antti Keskinen1-Dec-03 10:32
Antti Keskinen1-Dec-03 10:32 
GeneralRe: Devices Pin
DmitryR1-Dec-03 20:19
DmitryR1-Dec-03 20:19 
Generalplease help me with this homework Pin
gina781-Dec-03 1:29
gina781-Dec-03 1:29 
GeneralRe: please help me with this homework Pin
Ryan Roberts1-Dec-03 1:34
Ryan Roberts1-Dec-03 1:34 
GeneralRe: please help me with this homework Pin
gina781-Dec-03 1:39
gina781-Dec-03 1:39 
GeneralRe: please help me with this homework Pin
Roger Allen1-Dec-03 1:36
Roger Allen1-Dec-03 1:36 
GeneralRe: please help me with this homework Pin
gina781-Dec-03 2:21
gina781-Dec-03 2:21 
GeneralRe: please help me with this homework Pin
jhwurmbach1-Dec-03 2:29
jhwurmbach1-Dec-03 2:29 
GeneralRe: please help me with this homework Pin
gina781-Dec-03 2:41
gina781-Dec-03 2:41 
GeneralRe: please help me with this homework Pin
jhwurmbach1-Dec-03 2:50
jhwurmbach1-Dec-03 2:50 
GeneralRe: please help me with this homework Pin
gina781-Dec-03 2:56
gina781-Dec-03 2:56 
GeneralRe: please help me with this homework Pin
jhwurmbach1-Dec-03 3:05
jhwurmbach1-Dec-03 3:05 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.