Chapter 12
Adding Class to C++
In This Chapter
Grouping data into classes
Declaring and defining class members
Adding active properties to the class
Accessing class member functions
Overloading member functions
Programs often deal with groups of data: a person’s name, rank, and serial number, stuff like that. Any one of these values is not sufficient to describe a person — only in the aggregate do the values make any sense. A simple structure such as an array is great for holding standalone values, but it doesn’t work well for data groups. This makes good ol’ arrays inadequate for storing complex data (such as personal credit records that the Web companies maintain so they can lose them to hackers).
For reasons that will become clear shortly, I’ll call such a grouping of data an object. A microwave oven is an object (see Chapter 11 if that doesn’t make sense). You are an object (no offense). Your savings account information in a database is an object.
Introducing the Class
How nice ...
Get C++ For Dummies, 7th Edition 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.