KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I'm still relatively new to C++ and I can't seem to figure out the difference in the following two ways of coding a function that may take one parameter or maybe two or three or more. Anyway, here's my point function overload: int aClass::doSomething(int required) { //DO SOMETHING } int aClass::doSomething(int required, int optional) { //DO SOMETHING } how is this different to, default value: int aClass::doSomething(int required, int optional = 0) { //DO SOMETHING } I know in different circumstances one may be more suitable than another but what kinds of things should I be aware of when choosing between each of these options?
Tags (comma-separated)
Save Edits
Cancel