Contents

Section 6.1 Function Basics

Section 6.2 Argument Passing

Section 6.3 Return Types and the return Statement

Section 6.4 Overloaded Functions

Section 6.5 Features for Specialized Uses

Section 6.6 Function Matching

Section 6.7 Pointers to Functions

Chapter Summary

Defined Terms

This chapter describes how to define and declare functions. We’ll cover how arguments are passed to and values returned from functions. In C++, functions can be overloaded, which means that we can use the same name for several different functions. We’ll cover both how to overload functions and how the compiler selects the matching version for a particular call from several overloaded functions. The chapter closes by describing pointers to functions.

A function is ...

Get C++ Primer, Fifth Edition 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.