Skip to content

Instantly share code, notes, and snippets.

Created Jun 30, 2012
What would you like to do?
Default arguments aren't overloads
#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()
// 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