void func ( string word = "hello", int b ) {
// some jobs
}
in another function
//calling
func ( "", 10 ) ;
When I have compiled it, compiler emits error ;
default argument missing for parameter
How can I fix it without changing anything, of course, such as not making "int b = 0" ? Moreover, I want use that function like func ( 10 ) or func ( "hi" ) ? Is my compiler not do its job, properly ?
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" ?