lundi 2 juillet 2018

change function to a class with method for setting input variables of function

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 ?

Aucun commentaire:

Enregistrer un commentaire