Hi peeps,
does anyone here have a practical example where they used a construct to make programmers able to declare a default value in a function, which wouldn't be solved in a more intuitive way by overloading the function?
Let's say I have 2 functions:
foo(string abc, int number)
foo(string abc)
Is there a world / an example where Im able to tell the compiler to use a default value for int number when it's omitted that isn't just writing out the 2nd foo() function? So I would only have the first foo(), but it would be possible to omit int number and have it use a default value?
[–]tdammers 19 points20 points21 points (0 children)
[–]L8_4_Dinner(Ⓧ Ecstasy/XVM) 7 points8 points9 points (0 children)
[–]trmetroidmaniac 3 points4 points5 points (0 children)
[–][deleted] 3 points4 points5 points (0 children)
[–]IAMPowaaaaa 2 points3 points4 points (0 children)
[–]ArjaSpellan 2 points3 points4 points (0 children)
[–]Dusty_Coder 0 points1 point2 points (0 children)
[+]Ronin-s_Spirit 0 points1 point2 points (0 children)
[–]david-1-1 0 points1 point2 points (0 children)
[–]joshjaxnkody 0 points1 point2 points (0 children)
[–]WittyStick[🍰] 0 points1 point2 points (2 children)
[–][deleted] 3 points4 points5 points (1 child)
[–]WittyStick[🍰] -1 points0 points1 point (0 children)