Introduction to OOP Chapter 4: Classes and Methods: next previous audio real text

A Typical Example, Class Definition in C++


class PlayingCard {
public:
    enum Suits {Spade, Diamond, Club, Heart};

    Suits suit () { return suitValue; }
    int   rank () { return rankValue; }

private:
    Suits suitValue;
    int   rankValue;
};

Note syntax for methods, data fields, and visibility modifiers. (Will see more on syntax later).

Intro OOP, Chapter 4, Slide 7