Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. pointer to a function

pointer to a function

Scheduled Pinned Locked Moved Solved General and Desktop
2 Posts 2 Posters 293 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    rezaMSLM
    wrote on last edited by
    #1

    HI
    I have a function:

    void MainWindow::WriteID()
    {
    ...
    }
    

    I want to make a pointer to this function. here is my code:

    void (*F_Code)() = MainWindow::WriteID;
    

    but receive this error:

     error: void value not ignored as it ought to be
         void (*F_Code)() = MainWindow::WriteID;
    

    why?

    aha_1980A 1 Reply Last reply
    0
    • R rezaMSLM

      HI
      I have a function:

      void MainWindow::WriteID()
      {
      ...
      }
      

      I want to make a pointer to this function. here is my code:

      void (*F_Code)() = MainWindow::WriteID;
      

      but receive this error:

       error: void value not ignored as it ought to be
           void (*F_Code)() = MainWindow::WriteID;
      

      why?

      aha_1980A Offline
      aha_1980A Offline
      aha_1980
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @rezaMSLM you need to google for "pointer to member function" to get the correct syntax.

      Qt has to stay free or it will die.

      1 Reply Last reply
      4

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved