Lesson 34. Capstone project: card game
After reading lesson 34, you’ll be able to
- Use classes to build a more complex program
- Use classes others have created to improve your program
- Allow users to play a simple version of the card game War
When you make your own object types, you can organize larger programs so that they’re easier to write. The principles of modularity and abstraction introduced with functions also apply to classes. Classes are used to package a set of properties and behaviors common to a set of objects so that the objects can be used consistently in a program.
A common first program with classes is to simulate playing some sort of game with the user.
The problem
You want to simulate playing the card game War. Each ...
Get Get Programming now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.