Created
June 30, 2012 13:54
-
-
Save rowanj/3023854 to your computer and use it in GitHub Desktop.
Default arguments aren't overloads
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
using namespace std; | |
// #include <some header> | |
void foo(int x, int y); | |
// but we always use y = 2 with foo | |
void foo(int x, int y = 2); | |
int main() | |
{ | |
foo(1); | |
} | |
// and later link to the One Definition of foo | |
void foo(int x, int y) | |
{ | |
cout << "x: " << x << " y: " << y << endl; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment