This question already has an answer here:
What are the consequences (pros and cons) of using a single structure as the argument, instead of a list of parameters. Some of the advantages I see are: 1. create multiple default parameters. 2. Need not reply on the order of the parameters. 3. In case of a refactoring, need not change the signature of the method. Some disadvantages I expect are: 1. May be difficult to handle parameters with "&". 2. May not make sense to use "function overloading" and we may have to put all the possible parameters in a single structure and all the combination of the parameters may not make sense all the time!
What are the other pros and cons of this approach?
Aucun commentaire:
Enregistrer un commentaire