3. Introduction to Classes, Objects and Strings

Objectives

In this chapter you’ll:

• 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 a member function of an object to perform a task.

• Learn the differences between data members of a class and local variables of a function.

• Use a constructor to initialize an object’s data when the object is created.

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

• Use objects of class string.

Get C++11 for Programmers, Second Edition now with O’Reilly online learning.

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