3 Introduction to Classes, Objects, Member Functions and Strings


In this chapter you’ll:

  • Begin programming with the object-oriented concepts introduced in Section 1.8.

  • Define a class and use it to create an object.

  • Implement a class’s behaviors as member functions.

  • Implement a class’s attributes as data members.

  • Call an object’s member functions to make them perform their tasks.

  • Access and manipulate private data members through their corresponding public get and set functions to enforce encapsulation of the data.

  • Learn what local variables of a member function are and how they differ from data members of a class.

  • Use a constructor to initialize an object’s data.

  • Validate the data passed to a constructor or member function.

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

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.