Functions
Declare
return_type func_name(parameters)
{
code
return output;
}
bool yesOrNo(int thing1, bool thing2 = false)
{
code
return true;
}Note: the return type void means there doesn't need to be a output
Note: defaults must be at the end
Inline
This makes it so that when you call a function,
the compiler will place the block of code where the function was called
inline
void funcName()
{
code
}Overloading
You can declare multiple functions,
all with different parameters,
cpp will automatically switch between the functions depending the arguments given.
It will switch based on...
- the number of arguments
- the variable types