okay, a function uses pass by reference can handle a literal, but only if the parameter is constant .
I'm guessing that this shouldn't be a problem for an Add() function. The only time you'd need a non-constant pass by reference were if you were going to modify the parameter (ie use it as another return value), but that obviously wouldn't make sense for a literal, which can't be 'changed.'
Code:
#include <cstdlib>
// this works fine with anything
void foo(const int& bar)
{
int baz = bar;
}
// this will not work with a literal!
void pitythefoo(int& bar)
{
int baz = bar;
}
int main(int argc, char *argv[])
{
int var = 5;
foo(var);
foo(5);
system("PAUSE");
return EXIT_SUCCESS;
}