Skip to content

Latest commit

 

History

History
25 lines (15 loc) · 1.12 KB

07_object-oriented.md

File metadata and controls

25 lines (15 loc) · 1.12 KB

Object-Oriented Programming

This is not part of the 10/12 tutorial

I may develop it further in the future, but for now it is not going to fit within the tutorial, and it is the most disposeable part. But please let me know if you do want help or anything with this topic.

Object-oriented proramming

Object-oriented programming centers around the definition of classes, which hold attributes and methods in one cohesive object. On one hand, this is sort of "where it all comes together," but in reality, it is far less important than the preceding sections (shocking, I know). Classes make your code much cleaner, but you can get by without them for simple things, whereas you would have a hard time doing without any of the last sections.

So this is just going to scratch the surface.

Defining a class

A class is sort of a template, or maybe a container. It gives details about the properties of objects of that class (recursive, but that's how classes are).

The "class"ic example is a polygon:

class Polygon:
    def __init__(self, num_sides):
        self.num_sides = num_sides

(TBC)