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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T23:37:13+00:00 2026-06-02T23:37:13+00:00

I would like to forward a callback to a function pointer. So I declare

  • 0

I would like to forward a callback to a function pointer. So I declare a static (int*) m_pointer1, as well as a method void RegisterCallback1( (int*)fct)

in class1.h:

public:
   int RegisterCallback1( int (*fct) );
private:
   static int (*m_Callback1);

in class1.cpp:

int class1::RegisterCallback1( int (*fct) )
{
    m_Callback1= fct;
}

then, I want to forward the callback to the function pointer:

void class1::Callback1()
{
   (*m_Callback1)();
}

But I get a compiler error “Expression must have (pointer-to)- function type
I have followed tutorial and read about function pointers and they seem to do it this way without any problems. Any ideas why?

EDIT:
So, I declare (int*)(void)m_Callback1 -Visual Studio requires a void there…-
Then how do I call the registerCallback function with the argument?

class1.RegisterCallBack1(  ??? - class2::callback -??? );
  • 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-02T23:37:14+00:00Added an answer on June 2, 2026 at 11:37 pm

    You haven’t declared a function pointer, you’ve declared a normal data pointer. You are missing () at the end of the declaration.

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

Sidebar

Related Questions

I would like to create a forward-function that terminates the caller-function. Currently I'm using
I would like to forward iphone users to a mobile version of my site
I would like to disallow double forward slashes (//) in my regular expression (and
Would like to know the c# code to actually retrieve the IP type: Static
I receive a POST request at my PHP script and would like to forward
I would like for my site when someone clicks Back or Forward for the
My question is hopefully pretty straight forward. Upon submitting my form, I would like
I would like to forward users using .htaccess When they visit the page: http://www.example.com/add_event/
I would like a plain forward DTO generation tool that would either Generate it
Firstly, I would like to thank everyone here in advance. I look very forward

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.