3 Introduction to Classes, Objects, Member Functions and Strings

Objectives

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 O’Reilly online learning.

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