Thread: static array of function pointers within class

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date
    Apr 2003
    Posts
    2,663
    Not the most useful program ever written, but there you go.
    Wow! Interesting. Thanks for the enlightening.

    Hold everything. I made a mistake when I was testing your code: I used the pointer to execute the static function, which of course should work without having to create any objects. I don't get any compile errors with your code, but if I add a line in main() to execute the non-static function:

    pf1(); //error C2064: term does not evaluate to a function

    I need to create an object before I can execute the function:

    Feeble aFeeble;
    (aFeeble.*pf1)();

    I guess that's what you've been saying all along: you can assign pointers to the non-static member functions before objects exist, but you can't execute the function unless you use an object.
    Last edited by 7stud; 11-02-2005 at 03:46 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. seg fault at vectornew
    By tytelizgal in forum C Programming
    Replies: 2
    Last Post: 10-25-2008, 01:22 PM
  2. Screwy Linker Error - VC2005
    By Tonto in forum C++ Programming
    Replies: 5
    Last Post: 06-19-2007, 02:39 PM
  3. Dikumud
    By maxorator in forum C++ Programming
    Replies: 1
    Last Post: 10-01-2005, 06:39 AM
  4. dynamic array of base class pointers
    By Corrington_j in forum C++ Programming
    Replies: 1
    Last Post: 11-16-2003, 05:58 AM
  5. Struct *** initialization
    By Saravanan in forum C Programming
    Replies: 20
    Last Post: 10-09-2003, 12:04 PM