9 Classes: A Deeper Look

Objectives

In this chapter you’ll:

  • Engineer a class to separate its interface from its implementation and encourage reuse.

  • Access class members via an object’s name or a reference using the dot (.) operator.

  • Access class members via a pointer to an object using the arrow (->) operator.

  • Use destructors to perform “termination housekeeping.”

  • Learn the order of constructor and destructor calls.

  • Learn about the dangers of returning a reference or a pointer to private data.

  • Assign the data members of one object to those of another object.

  • Create objects composed of other objects.

  • Use friend functions and learn how to declare friend classes.

  • Use the this pointer in a member function to access a non-static class member. ...

Get C++ How to Program, 10/e now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.