Chapter 5. Functions

In this chapter we discuss the essentials of function declarations, prototypes, and signatures; overloading functions; function call resolution; default/optional arguments; temporary variables and when they’re created; reference parameters and return values; and inline functions.

5.1

Function Declarations

106

5.2

Overloading Functions

107

5.3

Optional Arguments

109

5.4

Operator Overloading

111

5.5

Parameter Passing by Value

116

5.6

Parameter Passing by Reference

118

5.7

References to const

121

5.8

Function Return Values

122

5.9

Returning References from Functions

122

5.10

Overloading on const-ness

124

5.11

Inline Functions

126

5.12

Inlining versus Macro Expansion

127

Function Declarations

Functions in C++ are very similar to functions and subroutines in other ...

Get An Introduction to Design Patterns in C++ with Qt 4 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.