[try Beta version]
Not logged in

 
void and bool

Jan 6, 2018 at 2:37pm
Is there a way i can make this function a boolean?

 
  void bool Pacman::CollisionCheck(int x1, int y1, int width1, int height1, int x2, int y2, int width2, int height2)
Jan 6, 2018 at 2:45pm
Remove the void at the beginning.
Jan 6, 2018 at 2:48pm
When i remove void, and i use this in a if statement i get the error "epression must have bool type or be convertible to bool
Jan 6, 2018 at 3:11pm
What is the expression?
Jan 6, 2018 at 5:59pm
Post any error message here, verbatim, along with any relevant parts of your code - that if-statement, for example.

http://www.cplusplus.com/forum/beginner/1/
http://www.catb.org/esr/faqs/smart-questions.html
Jan 7, 2018 at 7:04pm
Can't say much without your code but I would advise to check if your function is returning a Boolean value.

looking at the error you're getting it sounds like you're not returning a bool.

1
2
3
4
5
6
7
8
9
10
11
bool Pacman::CollisionCheck(int x1, int y1, int width1, int height1, int x2, int y2, int width2, int height2)
{
    bool status;

    statement;
    statement;
    statement;


    return status;
}
Last edited on Jan 7, 2018 at 7:04pm
Topic archived. No new replies allowed.