O'Reilly logo

Sams Teach Yourself C++ in 21 Days , Fifth Edition by Bradley Jones, Jesse Liberty

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

Day 5. Organizing into Functions

Although object-oriented programming has shifted attention from functions and toward objects, functions nonetheless remain a central component of any program. Global functions can exist outside of objects and classes, and member functions (sometimes called member methods) exist within a class and do its work.

Today, you will learn

• What a function is and what its parts are

• How to declare and define functions

• How to pass parameters into functions

• How to return a value from a function

You’ll start with global functions today, and tomorrow you’ll see how functions work from within classes and objects as well.

What Is a Function?

A function is, in effect, a subprogram that can act on data and return a value. ...

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