Introduction to Classes

Classes and objects are very powerful programming tools. They make programming easier. In fact, you are already familiar with the concept of classes and objects. A class is a classification of an object. Like person or image. An object is a particular instance of a class. Like Mary is an instance of Person.

Objects have attributes, such as a person’s name, height, and age. Objects also have methods. Methods define what an object can do: like run, jump, or sit.

Why Learn About Classes?

Each character in an adventure game needs data: a name, location, strength; are they raising their arm; what direction they ...

Get Program Arcade Games: With Python and Pygame, Fourth Edition now with O’Reilly online learning.

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