variable or field `findAccount' declared void

I've been searching all over for this and I can't find a comparable example of this error occurring. It seems to pop up for a lot of reasons.

It's a function, called 'findAccount' of course. It's declared in the public section of a class, and called in some subsequent classes. Here's the function:
1
2
3
4
5
6
7
8
9
10
void findAccount(s.accNo, accountNo)
        {
             SavingsAccount s;
             Transaction t;
             
             if (s.accNo == t.accountNo)
                Customer.applyTrans();
             else
                (s.accNo++; t.findAccount());
        };


And the error picks up the first line of the declaration. Any advice without me posting the whole program (180-odd lines)?
Last edited on
closed account (zb0S216C)
Your first argument is invalid. You cannot use class members as argument types. Passing class members as arguments is fine, but not when your using them as types.
Last edited on
Thanks, I just guessed that was the problem but now I know why. I changed them to ints, the type that both members are, and then the call elsewhere includes the members as it should.

1
2
3
4
5
6
7
8
9
10
void findAccount(int, int)
        {
             int match1;
             int match2;
             
             if (match1 == match2)
                Customer.applyTrans();
             else
                (match1++; t.findAccount());
        };
Last edited on
Topic archived. No new replies allowed.