Chapter 5. Programming Revisited

In this chapter, we’ll cover several more advanced topics that you will need to understand to use some of the other code samples in this book. First among these is object-oriented programming (OOP), that is, programming using classes and objects as the fundamental units to organize your code. This topic is a fundamental part of the nature of C++, which is quite important to understand if you’re going to work with openFrameworks (oF) in any meaningful way. We will cover file structure and how to create classes and objects in C++. Finally, we will cover pointers and references, which are quite advanced topics but important ones if you plan on doing any serious work with openFrameworks. It also helps a lot when looking at libraries created for Arduino or if you decide to build your own library.

Object-Oriented Programming

To work with oF—and, in many cases, to work with Processing—you need to understand object-oriented programming, which is a way of organizing and assembling your code that is used in many different kinds of programming languages and for many different purposes. Hundreds of programming languages support OOP, and the principles don’t vary too greatly across languages, so once you understand the basics of it, you’ll find yourself better able to follow along with code that you encounter and better able to construct your own code when you’re working on a project. At its core, OOP is the philosophy of creating classes that represent different ...

Get Programming Interactivity now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.