Learn creative coding writing simple programs

104. OOP means Object Oriented Programming

Object Oriented Programming is a technique that helps us divide programs into smaller parts using something called Classes and Objects. Cars, trees or people can be Objects. Each object in an instance of a Class. The Class is like the recipe used to build each Object. You use the same Class to build different instances of one kind of Object.

Imagine you want to create cars. To create car A you take the Car Class and create your first car by using new Car(). When you want a second car (car B) you take the same Class and create a new instance. You can use different Classes to create different kinds of objects. In this episode we only have one Class, called Car.

Each created object (each car) has properties and methods. Properties are things like color, amount of doors, brand and model. Methods are things the Object can do. For example a car can start, stop, change speed and open doors. Our simple car can only do one thing: drive().

Tags: oop, class, object, instance

Code editor

You can make changes to the code below. Then
Below you can ask and answer questions related to this video. If your question is unrelated to the video, please post it at the Processing Forum as I'm unable to help with all of your programs and still have enough free time to eat and sleep :)
comments powered by Disqus