Missing default argument - compiler error

前端 未结 5 931
無奈伤痛
無奈伤痛 2021-01-31 15:17
void func ( string word = \"hello\", int b ) {

  // some jobs

}

in another function

 //calling 
 func ( \"\", 10 ) ;

When I have compiled it, compi

5条回答
  •  生来不讨喜
    2021-01-31 16:10

    You can't have non-default parameters after your default parameters begin. Put another way, how would you specify a value for b leaving word to the default of "hello" ?

提交回复
热议问题