I am writing an API for my library. I have a function that takes 5 classes as inputs :
result func(A a,B b,C c,D d,E e);
I want to change it to a class that takes the inputs one by one and then the class can be execute when all inputs set :
class func
{
void setA(A a);
void setB(B b);
.......
result execut();
}
i want to know this is a bad idea ?
I think this is not bad idea to make a class from my function, even if later i find that the function is a better choice, i can write a helper function over of my function class like this:
result Func(A a,B b,C c,D d,E e)
{
func f;
f.setA(a);
f.setB(b);
......
return f.execute();
}