Book
Module 7 - Section 1 - Classes
Module 7 - Section 1 - Classes
Completion requirements
View
After the completion of this module the students will be able to:
- identify a class inside Python code
- present the necessary parts for constructing a class
- create code to construct a simple class
- create and use methods in a class
- distinguish the references from the objects of a class
- rewrite the classes code to implement constructors
7.1.1 - What is a Class
Classes and objects are very powerful programming tools. They make programming easier.
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.
A Class is a structure that has all the information needed to define all the characteristics of an object.
In the above image Animal is a Class and Dog and Sheep are Animal Class Objects.
The Animal Class has attributes (characteristics) of the animals, like color, number of legs, weight, speed, etc.