Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Using member functions inside boolean statements.
Index -> Programming, C++ -> C++ Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
abcdefghijklmnopqrstuvwxy




PostPosted: Thu Jan 25, 2007 3:11 am   Post subject: Using member functions inside boolean statements.

Hey. Is there anything I should know about boolean statements and using functions inside them?

Look at this code:

code:

void handle_tac_events(std::vector<Tac>& vTacs, std::vector<Tac>::iterator iter, std::vector<Tac>::iterator end, int& x, int& y, Board& board)
{
  int result;
  for (; iter != end ; ++iter)
  {
    result = iter->handleEvents(x, y, board);
    if (result == MOVED_A_TAC )
    { 
      vTacs.push_back(Tac(iter->getColor(), board));
      return;
    }
    else if (result == CLICKED_A_TAC)
    {
      return;
    }
  }
  return;
}


If i substitute "iter->handleEvents(x, y, board)" with result in the if statements why does it not ever return true? Whereas with result in its place it works fine...
Sponsor
Sponsor
Sponsor
sponsor
Display posts from previous:   
   Index -> Programming, C++ -> C++ Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 1 Posts ]
Jump to:   


Style:  
Search: