Object-oriented programming

Table of Contents

18.1. Introduction
18.2. What are objects and classes? An example
18.2.1. Objects description
18.2.2. Methods
18.2.3. Classes
18.2.4. Creating objects
18.3. Defining classes in Python
18.4. Combining objects
18.5. Classes and objects in Python: technical aspects
18.5.1. Namespaces
18.5.2. Objects lifespan
18.5.3. Objects equality
18.5.4. Classes and types
18.5.5. Getting information on classes and instances
18.6. Solutions

18.1. Introduction

This chapter introduces objects, that are a way to organize code and data, and classes, that are a mechanism to describe new kinds of objects. We start by the description of what objects, classes and methods are, based on an example (Section 18.2). We then show its class definition (Section 18.3). We then explain how to combine objects in order to build an application (Section 18.4). Finally, technical aspects of classes and objects in Python are presented (Section 18.5).

In the next chapter (Chapter 19), concepts related to object-oriented design will be developped.