O'Reilly logo

Sams Teach Yourself C++ in One Hour a Day, Sixth Edition by Bradley Jones, Siddhartha Rao, 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

Chapter 9. Exploiting References

In the previous lesson, you learned how to use pointers to manipulate objects on the free store and how to refer to those objects indirectly. References, the topic of this lesson, give you almost all the power of pointers but with a much easier syntax.

In this lesson, you will learn

  • What references are

  • How references differ from pointers

  • How to create references and use them

  • What the limitations of references are

  • How to pass values and objects into and out of functions by reference

What Is a Reference?

A reference is an alias; when you create a reference, you initialize it with the name of another object, the target. From that moment on, the reference acts as an alternative name for the target, and anything you do to the ...

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