Searching for: Function Declaration in C++
A function is a block of code that can be called from another location in the program or class. It is used to reduce the repetition of multiple lines of code. The return statement concludes the execution of the block of code. The function can either return a value (of dataType, declared in the function header), or return nothing (use the 'void' dataType). Within classes, functions are known are 'Methods'.
Friend functions can access private and protected members of a class object passed into the function.
Similar to function overloading, where functionality varies depending on different numbers and types of inputs, operators can be overloaded as well, within a class.
A friend class can access all members (private or protected) of a class in which it is declared a friend.
Next Page >