Introduction to OOP | Chapter 4: Classes and Methods: | next | previous | audio | real | text |
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).