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 7662425
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T13:47:59+00:00 2026-05-31T13:47:59+00:00

I am trying to store a pointer to a member function in a structure

  • 0

I am trying to store a pointer to a member function in a structure which will be used to call the function later in my program.

Something like this:

// abc.h
namespace XYZ {
typedef void func(const uint8_t *buf, int len);
struct holder
{
    // other members
    func * storePtr;
}
} // end of namespace

the other file as:

// pqr.h
#include abc.h
namespace XYZ {
 class pqr {
   // data members and other functions
   void func1(const uint8_t *buffer, int length);
   void func2(func *section);
   void func3();
   }
} // end of namespace

Now my cpp file needs to store instance of this func1 in my structure member storePtr

// app.cpp
#include pqr.h
void pqr::funct3()
{
   // Do something
   func2(func1);
}
void pqr::func2(func * section)
{
   holder h;
   h.storePtr = section;
}

But I am getting compilation error at line “func2(func1);” as
“error C3867: ‘pqr::func1’: function call missing argument list; use ‘&pqr::func1’ to create a pointer to member”

I have used &pqr:: to define the scope but it also doesn’t solve my problem and I am not able to understand what to do.

  • 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-05-31T13:48:01+00:00Added an answer on May 31, 2026 at 1:48 pm

    Pointers to member function are not the same thing as pointers to normal functions – have a look at the explanation and example here: http://msdn.microsoft.com/en-us/library/k8336763.aspx

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

Sidebar

Related Questions

I'm trying to store member function pointers by templates like this: (This is a
I am trying to store a pointer as a member variable, so that during
Based on this question which was closed rather quickly: Trying to create a program
I'm trying to store a password in a file that I'd like to retrieve
I'm trying to store a reference of an HTML tag for later reuse. e.g.
I'm trying to save the context of the registers and store the stack pointer
I'm trying to create a template class that stores a function pointer to a
I am currently trying to write a program to store data about people into
Hey, while trying to iterate with next as a pointer in my structure, it
Hey, I've got a question about general member function pointers. I'm trying to achieve

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.