Chapter 22

Structured Play: Making Classes Do Things

In This Chapter

arrow Adding member functions to a class

arrow Defining the member function

arrow Invoking the member function

arrow Accessing one member from another member

arrow Overloading member functions

Classes were introduced to the C language as a convenient way to group unalike-but-related data elements — for example, the Social Security number and name of the same person. (That’s the way I introduce them in Chapter 19.) C++ expanded the concept of classes to give them the ability to mimic objects in the real world. That’s the essence of the difference between C and C++.

In the previous chapter, I review at a high level the concept of object-oriented programming. In this chapter, I make it more concrete by examining the active features of a class that allow it to better mimic the object-oriented world we live in.

Activating Our Objects

C++ uses classes to simulate real-world objects. However, the classes in Chapter 19 are lacking in that regard because ...

Get Beginning Programming with C++ For Dummies, 2nd Edition now with O’Reilly online learning.

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