I have a function, which looks something like this:
ClassA& ClassB::Check(int x){
//some calculations in a loop, if a condition is met, a reference to a ClassA object is given
}
I'm getting the "control reaches end of non-void function" error. As far as I understand, this is because, the function wont always return something, am I right?
The function is getting the mouse coordinates and checking witch objects was selected. If something was selected, then do stuff, otherwise do nothing.
What would be the best option to solve this? Should I create and return an object with some kind of flag to check against?