15. Object-Oriented Poker

Any hour of any day in Las Vegas, Nevada, you can hear them: the unending “ding-ding-ding!” sounds from what used to be “one-armed bandits,” but these days are more likely to be machines playing video poker.

Now—at no expense!—you can bring the excitement of this classic game to your own computer, thanks to C++. Basically, each round of the game is a hand of draw poker, followed by a payout at the end. (Sorry, but I’m not set up to take your money, even if it were legal to do so. You’ll have to be content with winning virtual dollars.)

Although it’s possible to write this program without object orientation, I’m going to use this chapter to further demonstrate some more object-oriented features: how to return an object ...

Get C++ Without Fear: A Beginner’s Guide That Makes You Feel Smart, Third Edition now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.