No, that is not very complex at all but the syntax of a strongly typed language like c++ is quite different from the "sloppy web languages". I feel the same whenever I have to code something in JS...
Here a quick snippet showing how that works in principle. Hope that helps
#include "Arduino.h"
class Motor
{
public:
Motor(int _pin)
{
pin = _pin;
}
int showPin()
{
Serial.print("Motor Pin: ");
Serial.println(pin);
}
protected:
int pin;
};
class Car
{
public:
Car(int pin1, int pin2, int pin3)
: m1(pin1), m2(pin2), m3(pin3)
{ }
int showPins()
{
m1.showPin();
m2.showPin();
m3.showPin();
}
protected:
Motor m1, m2, m3;
};
void setup()
{
constexpr int pin1 = 3, pin2 = 5, pin3 = 6;
Car myA(pin1, pin2, pin3);
myA.showPins();
}
void loop()
{
}