M
mufasa
We know C++ supports functions that can carry default values as
follows:
someFunction(int a, int b, int c =20);
So calling someFunction(x,y) is perfectly legal!
However, if I need to information by reference, can initiate the
referenced variable to a default value?
Eg:
int main()
{
int a = 20;
int b, c;
int &r = a;
someFunction(b,c); // <-------------------- POSSIBLE??
someFunction(b,c,r);//<-------------------- This is allowed
}
someFunction(int x, int y, int& z = 30); //<-- WELL??
{
}
follows:
someFunction(int a, int b, int c =20);
So calling someFunction(x,y) is perfectly legal!
However, if I need to information by reference, can initiate the
referenced variable to a default value?
Eg:
int main()
{
int a = 20;
int b, c;
int &r = a;
someFunction(b,c); // <-------------------- POSSIBLE??
someFunction(b,c,r);//<-------------------- This is allowed
}
someFunction(int x, int y, int& z = 30); //<-- WELL??
{
}