Sams Teach Yourself C++ in 21 Days

(singke) #1

DAY 5


WEEK 1

5 Organizing into Functions

Although object-oriented programming has shifted attention from functions and
toward objects, functions nonetheless remain a central component of any pro-
gram. 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.

Free download pdf