Why are default arguments trailing ones?

前端 未结 4 1280
难免孤独
难免孤独 2021-01-17 17:46

Why are default arguments in C++ trailing ones?

4条回答
  •  被撕碎了的回忆
    2021-01-17 17:58

    Because in a function call you have to call the non-default arguments in any case. If you put your default argument at the beginning of the argument list, how are you supposed to say you are setting the default argument or the other ones?

提交回复
热议问题