How many constructor arguments is too many?

前端 未结 15 1264
[愿得一人]
[愿得一人] 2020-11-29 15:03

Let\'s say you have a class called Customer, which contains the following fields:

  • UserName
  • Email
  • First Name
  • Last Name

15条回答
  •  一个人的身影
    2020-11-29 16:00

    Unless it's more than 1 argument, I always use arrays or objects as constructor parameters and rely on error checking to make sure the required parameters are there.

提交回复
热议问题