Parameters and Default arguments?
Just wanted to know why default arguments require you to go right to left. And what are the significances of having default arguments. I mean instead of doing this...
int volume(int w = 4, int l = 5, int h = 5);
Why couldn't you simply do this...
int volume(int w, int l, int h)
w = 4;
l = 5;
h = 5
is there something I am not considering?
With default arguments you can call
int v = volume();. Your alternative forces you to pass 3 useless arguments.
Adding to maeriden's post - your alternative will always return 100, no matter what you pass it.
Topic archived. No new replies allowed.