740 B
740 B
title |
---|
Classes |
Classes
A Class is a "blueprint" for creating objects: writing a class permits to describe attributes and behaviors commons to every instance of this class.
Create a Class
To define a class the keyword class is used, followed by the name defining the class and a colon. All the following lines (code describing attributes and behaviors/methods) - are indented as in a Python function. For example, to create a class named Person, we can write:
class Person: <code describing attributes and behaviors/methods>
Class definitions must be executed before they have any effect.