Class Description of Card

In this slide we examine the structure of a typical class definition.

The class definition is explicitly divided into two sections, a public section and a private, or internal section. C++ also supports the idea of a constructor, which we will discuss in the next chapter.

There are four functions that simply access the attributes of a card. Such functions are often termed accessors.

Three other functions perform actions or change the internal state of the card.

The data fields are declared as private, meaning they are accessible only within the implementation of the card methods. It is considered good practice to make data fields private, rather than expose them to potential modification by making them public.

[audio] [real] Text to accompany slide21, in Chapter 3 of An Introduction to Object-Oriented Programming