Lesson 31. Creating a class for an object type
After reading lesson 31, you’ll be able to
- Define a Python class
- Define data properties for a class
- Define operations for a class
- Use a class to create objects of that type and perform operations
You can create your own types of objects to suit whatever your program needs. Except for atomic object types (int, float, bool), any object that you create is made up of other preexisting objects. As someone who implements a new object type, you get to define the properties that make up the object and the behaviors that you’ll allow an object to have (on its own or when interacting with other objects).
You usually define your own objects in order to have customized properties and behaviors, so that you ...
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.