C++: Will the following program compile and run correctly?
Will the following program compile and run correctly?
void f ( float n, int i = 10 ) ;
void f ( float a ) ;
void main( )
{
f ( 12.6 ) ;
}
void f ( float n, int i )
{
}
void f ( float n )
{
}
The above program results in an error (ambiguous call) since without the default argument the two functions have arguments that are matching in number, order and type.




Comments
Log in or create a user account to comment.