Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8825023
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T06:46:42+00:00 2026-06-14T06:46:42+00:00

I have grouped several member functions into an array. How do I access a

  • 0

I have grouped several member functions into an array. How do I access a function from the array? I am getting ‘error C2064: term does not evaluate to a function taking 0 arguments.’ See below.

class A
{
public:

    //Constructor
    A()
    {
        //Fill function array
        ClipFunction[0] = &A::ClipTop;
        ClipFunction[1] = &A::ClipBottom;
        ClipFunction[2] = &A::ClipLeft;
        ClipFunction[3] = &A::ClipRight;
    }

    //Declare array
    typedef void (A::*ClipFunction_ptr) ();
    ClipFunction_ptr ClipFunction[4];

    //Clipping functions
    void ClipTop();
    void ClipBottom();
    void ClipLeft();
    void ClipRight();

    //Start clipping process
    void StartClip();

};

//Define clipping functions
void A::ClipTop() {}
void A::ClipBottom() {}
void A::ClipLeft() {}
void A::ClipRight() {}

//Define A::StartClip()
void A::StartClip()
{
    //Run through all functions in the array
    for (unsigned int i = 0; i < 4; i++)
    {
        ClipFunction[i](); //ERROR. How do I access ClipFunction[i] ???
    }

}   
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T06:46:44+00:00Added an answer on June 14, 2026 at 6:46 am

    I think the problem is that you need use “this” explicitly as in http://publib.boulder.ibm.com/infocenter/lnxpcomp/v8v101/topic/com.ibm.xlcpp8l.doc/language/ref/cplr034.htm .

    So in your case, you should use

        (this ->* ClipFunction[i]) ();
    

    instead of

        ClipFunction[i]();
    

    PS

    When I reply this post, I didn’t see Vite Falcon’s answer. Basically we are saying the same thing but I don’t think his code ” this->(*ClipFunction[i])()” will compile because GCC gives errors on my machine. “(this->*ClipFunction[i])()” is the correct form.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have table View with grouped style with three sections. Get information from dictionary
I have a grouped uitableview which has several sections. The sections are showing up
I have a grouped UITableView that contains several cells (just standard UITableViewCell s), all
I have a matrix, whose rows are grouped into two groups. A class, and
I wonder what's the best approach to combine several CCSprites dynamically into one grouped
I have an Excel sheet where several rows are grouped together using Group and
I have a MySQL table that needs to be exported into several separate files.
I have an entity that needs to be grouped several times by three of
I have an application that writes several billion records into Cassandra and removes duplicates
I have several files that were uploaded and files are grouped in a folder.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.