Skip to content

Function that returns certain types depending of the value of a parameter #9834

Answered by erictraut
adrien-lsh asked this question in Q&A
Discussion options

You must be logged in to vote

The issue here is that both of your overloads have a default argument for the return_type parameter. That means foo() (with no arguments) applies to both of them. To eliminate the overlapping overload and make the overloads match the implementation, you should delete the = ... from the first overload.

Replies: 1 comment 9 replies

Comment options

You must be logged in to vote
9 replies
@adrien-lsh
Comment options

@erictraut
Comment options

@adrien-lsh
Comment options

@erictraut
Comment options

@adrien-lsh
Comment options

Answer selected by adrien-lsh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants