none
"Error: expression must have (pointer-to-) function type" RRS feed

  • Question

  • I don't know why am I getting this error in this simple code:

     

    //myfile.h
    struct part
    {
        unsigned char index:2;
        char part1:2;
        char part2:2;
        char part3:2;
    };
    
    class divided
    {
        part parts;
        public:
            char current_parts();
    };
    
    //myfile.cpp
    char divided::current_parts()
    {
        return parts.index(); //This is where the error is, underlining the "parts"
    };
    



     



    • Edited by FPSLemoneko Thursday, December 29, 2011 11:18 AM
    Thursday, December 29, 2011 11:17 AM

Answers

  • What's with () after parts.index? index is a variable, not a function.
    • Marked as answer by FPSLemoneko Thursday, December 29, 2011 11:41 AM
    Thursday, December 29, 2011 11:29 AM
    Moderator

All replies

  • What's with () after parts.index? index is a variable, not a function.
    • Marked as answer by FPSLemoneko Thursday, December 29, 2011 11:41 AM
    Thursday, December 29, 2011 11:29 AM
    Moderator
  • What's with () after parts.index? index is a variable, not a function.
    OUCH, I mistyped the "()" in both my project and in the thread. Thanks for the checking. I'm so sorry for posting a thread for such a silly mistake.
    Thursday, December 29, 2011 11:41 AM
  • can u help me

    Friday, December 7, 2012 4:41 AM
  • can u help me


    This is an old thread, but yea, post up your code, and I will see what I can do to help.
    Friday, December 7, 2012 11:06 AM
  • Don't hijack an existing discussion.  Start a new one with a subject that describes your issue.
    Saturday, December 8, 2012 12:55 AM