A Typical Class Definition

Here is a typical class definition, this in C++. A playing card basically has two bits of information, a rank and a suit. (We'll be adding more complexity later, such as keeping track of whether a card is face up or face down). The rank can be represented by an integer from 1 to 13. The suit is one of four possible values. In C++ we can use an enumerated data type to represent these values. The methods suit and rank will return these data values. Note the syntax used to define methods. Finally, note the use of the visibility modifiers public and private. We'll talk about those on the next slide.

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