Skip to content

Instantly share code, notes, and snippets.

@rowanj
Created Jun 30, 2012
Embed
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()
{
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