Inline Functions in C++

Calling a function has a performance penalty because you have to create variables, specify scope, pause the current variables and push data onto the call stack, just to name a few reasons. C++ allows you to define an inline function, which should be short, to improve the performance. In doing so, the compiler will actually…

Default Arguments

C++ has added the ability to have default arguments be defined when you declare your functions. To define a default value, you must specify the parameter name, and then assign it a value. If someone calls this function without passing an argument to the function, the computer will use 20 as the parameter. If they…

Overloading a Function

Overloading a function means that you can create different functions with the same name, as long as their signatures are different. That means that the parameter list must be of a different number and/or data types from one to another. Overloading functions can make reading code much clearer/easier. This way functions that perform the same…

Break and Continue

We’ve seen the break in a switch statement. It stops running the blocks of code, and simple exits out of the switch. In the same manner, if you use a break in a loop, it exits us from the loop prematurely (not by the loop condition). The continue keyword moves us to the end of…