782 B
782 B
Overview
Object Oriented (OO) programming
A Programming technique where code is organized as a collection of objects.
An object consists of:
- Data. Attributes
- Behavior. Methods, functions applied to the object.
You have already been using some OO during this course.
For example with Lists.
>>> nums = [1, 2, 3]
>>> nums.append(4) # Method
>>> nums.insert(1,10) # Method
>>> nums
[1, 10, 2, 3, 4] # Data
>>>
nums is an instance of a list.
Methods (append and insert) are attached to the instance (nums).
Summary
This will be a high-level overview of classes.
Most code involving classes will involve the topics covered in this section.
If you're merely using existing libraries, the code is typically fairly simple.