O'Reilly logo

C++ Primer, Fourth Edition by Barbara E. Moo, Josée Lajoie, Stanley B. Lippman

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 7. Functions

CONTENTS

Section 7.1 Defining a Function 226

Section 7.2 Argument Passing 229

Section 7.3 The return Statement 245

Section 7.4 Function Declarations 251

Section 7.5 Local Objects 254

Section 7.6 Inline Functions 256

Section 7.7 Class Member Functions 258

Section 7.8 Overloaded Functions 265

Section 7.9 Pointers to Functions 276

Chapter Summary 280

Defined Terms 280

This chapter describes how to define and declare functions. We’ll cover how arguments are passed to and values are returned from a function. We’ll then look at three special kinds of functions: inline functions, class member functions, and overloaded functions. The chapter closes with a more advanced topic: function pointers.

A function can be thought of as ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required