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

  • Home
  • SEARCH
  • 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 3444998
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T08:59:11+00:00 2026-05-18T08:59:11+00:00

Well I’ve hit the brick once again.. Again something I don’t see the reason

  • 0

Well I’ve hit the brick once again.. Again something I don’t see the reason it is wrong and have no idea how to make it work:

I have an instance of class Human. The class Human is derived from Object.. The Object class has a vitrual function called “PerformStep”. The Human Class overloads this function.
Human class also has the function “WalkAction”. Now I want to call this “walkaction” during the PerformStep – By member function pointer.
I like to do this by pointer as:
Humans are dumb: they know how to walk, but not when. So a god-instance would be asked during the step: “what shall I do now” – And then that god instance returns the pointer to the correct member function.

virtual void PerformStep() 
{
    postion.x += 0; //redundant line to check for the debugger
    CALL_MEMBER_FN(*this,&Human::WalkAction);
    Object::PerformStep();
}

Human::WalkAction:

void WalkAction(){
    position.x += 1;
}

CALL_MEMBER_FN (macro):
CALL_MEMBER_FN(object,ptrToMember) ((object).*(ptrToMember))

The problem is that when I run the program in debug mode, it completely ignores the line with the function pointer. – If I run it statement-by-statement it “jumps” over the line, if I put a breakpoint in walk action it never reaches the breakpoint.. If I put a breakpoint on the specific line, the breakpoints gets shoved to the next line.

What is happening here?

  • 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-18T08:59:12+00:00Added an answer on May 18, 2026 at 8:59 am

    That macro does nothing in this context, it just expands to a pointer to function. To actually call the function, you need an extra pair of parentheses.

    myObj->myfunc;   // does nothing
    myObj->myFunc(); // calls the function 
    

    I expect the compiler has optimized this out, so there’s no code to be executed or to break on. You could see this clearly by:

    • not using the macro in the first place (preferred)
    • using your compiler’s option to output source code interleaved with corresponding assembler.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Well, i'm learning to work with QML and i have one doubt. In my
Well, I have a class Customer (no base class). I need to cast from
Well i have a gridview where i have defined the columns on my own
Well i have a transparent div or the background is set to transparent :)
Well after much messing about I have finally got a query that gives sales
Well, i have the following need: create 3 dropdownlist with dependencies. My table in
well i have used an html file like these in iframe <iframe src=sample.html></iframe> is
Well im here because i have a problem. i have code that was created
Well, this is an interesting problem. I have an ASP.NET MVC3 Intranet application running
Well, I know there is a lots of posts about it, but I have

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.