Introduction into C++ (Part 3)

Introduction into C++ (Part 3)

C++ OOP Mastery: The Power of Composition (Has-A)

In software architecture, there are two primary ways to connect objects: Inheritance (Is-A) and Composition (Has-A). While beginners often try to solve everything through inheritance ("An Oscillator is an Envelope"), professionals prefer composition: "A Synthesizer has an Envelope."

1. Why Composition?

Think of our synthesizer as a modular rack. Each module (Oscillator, Envelope) is an independent class. The SynthEngine acts as the chassis where these modules are plugged in.

Introduction into C++ (Part 2)

Introduction into C++ (Part 2)

In this next example / tutorial we will have a look at sound producing program (aka a synth), for which we utilize the SDL library (Simple direct media library). We will go about the program, line for line and explain the different items.

Lets begin…​

First of all we have the includes for the SDL library, we will have a look at the header file later. Also we include cmath for math and iostream for in- and output (but in this example only output).