- #1
zeion
- 466
- 1
Hi,
If I have a method that takes in say 5 new variables and assigns 5 class variables to these new values, and I only wanted to change one of these variables, is it possible to reuse this method and only have it take in say 1 new variable and change one class variable without having to write different methods for changing each individual variable?
ie.
class testClass
{
void changeFive (int first, second, third, fourth, fifth)
{
testClassFirst = first;
testClassSecond = second;
...
}
void changeOne (int first)
{
testClassFirst = first;
}
}
If I have a method that takes in say 5 new variables and assigns 5 class variables to these new values, and I only wanted to change one of these variables, is it possible to reuse this method and only have it take in say 1 new variable and change one class variable without having to write different methods for changing each individual variable?
ie.
class testClass
{
void changeFive (int first, second, third, fourth, fifth)
{
testClassFirst = first;
testClassSecond = second;
...
}
void changeOne (int first)
{
testClassFirst = first;
}
}