Thread: class as argument problem

  1. #1
    Registered User
    Join Date
    Sep 2006
    Posts
    70

    Question class as argument problem

    Code:
    class RpKeyBoard
    {
          private:
                 unsigned int currentButtonX;           //storage for the current position on keyboard --> x-as
                 unsigned int currentButtonY;           //storage for the current position on keyboard -->y-as              
          public:
                 int buttonPushed;
                 unsigned int Buttons;
                 void goTo(int x , int y);
                 void getCurrentButton();   
    };
    
    RpKeyBoard keypad;                                            //KEY pad init
    RpKeyBoard filepad;
    
    void RpKeyBoard::getCurrentButton()
    {
                                  if(buttonPushed)
                                  {
                                                  Buttons == currentButtonX * currentButtonY;
                                                  }
                                  else
                                  {
                                      Buttons == 0;
                                      }
    }
    void RpReadBuffer(RpKeyBoard *keyBoard , int count) 
    {
         for(loop = 0; loop < count; loop++)
         {
                  keyBoard.getCurrentButton();              
                  }
    }
    Error
    Code:
    error: request for member 'getCurrentButton' in 'keyBoard', which is of non-class type 'RpKeyBoard*'
    how do i fix this?

  2. #2
    Deathray Engineer MacGyver's Avatar
    Join Date
    Mar 2007
    Posts
    3,210
    Code:
    keyBoard->getCurrentButton();
    keyBoard is a pointer.

  3. #3
    Registered User
    Join Date
    Sep 2006
    Posts
    70
    oooh , forgotten :P thnx

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Default class template problem
    By Elysia in forum C++ Programming
    Replies: 5
    Last Post: 07-11-2008, 08:44 AM
  2. problem with class
    By Mr.Pink in forum C++ Programming
    Replies: 26
    Last Post: 07-10-2005, 10:24 PM
  3. My Window Class
    By Epo in forum Game Programming
    Replies: 2
    Last Post: 07-10-2005, 02:33 PM
  4. problem with sending files to a class method..
    By utoots in forum C++ Programming
    Replies: 5
    Last Post: 04-02-2003, 01:38 AM
  5. Replies: 3
    Last Post: 12-03-2001, 01:45 PM