no viable conversion from returned value of type bankAccount to function return type int

Hi, I'm getting this error:

no viable conversion from returned value of type bankAccount to function return type int
|111|error: invalid operands to binary expression ('bankAccount' and 'int')|

What am I doing wrong?

Thanks


1
2
3
4
5
6
7
8
9
10
11
12
13
14
int bankAccount::searchfor(bankAccount lists[], int length, int acctNum)
{

  for(int i = 0; i < length; i++)
  {
    if(lists[i] == acctNum)
    {
        return lists[i];
    }
    else
        return -1;
  }

}
znewsome wrote:
What am I doing wrong?


(1) Trying to compare (using '==') an object of type bankAccount with an int on line 6.

(2) Trying to return a bankAccount (lists[i]) on line 8 when you promised to return an int.

I think it probably went most wrong in code you haven't shown.
Topic archived. No new replies allowed.