Saturday, December 27, 2008

iTutor: passing of parameters

Posted on Wednesday December 03, 2008 by Bellanov Apilli

While continuing on the test driver and implementing each method's respective switch statement, the problem I've come across relates to the passing of parameters. Take the following case:

case 1:{
addItem(item);
break;
}

It simply invokes the addItem method, sending the parameter "item". As you've instructed, this parameter should go in the method declaration, which brought about another question.

In my mind, the proposed method declaration would be as follows:
addItem(int a, int item1, int item2, int item3, ... )

Where each "item" will map with its respective method call (the method that needs the said parameter). I am formulating to append to this "item" information into the data structure, assigning each item value soon after the class decompression. I just wish for confirmation so that everything I've been doing isn't in vain.

1 comment:

  1. Yes, it is fine to have those many parameters to the test method. Kunal suggested that it should be fine.

    ReplyDelete