Hi together. Thank you for all the replies. Your answers look really complicated to me. It looks like they are dive deep into the interna of the language. Still I learned something and it helped me to understand the lifecycle of a object a bit more.
A question for my understanding: Is it necessary to clean/delete the objects when they are created at the initialization phase of the project and afterwards only used? I mean as soon as I gonna shut down the arduino, the program stops anyway and RAM is empty again.
At the end I was able to solve my problems by changing:
Joint(...){
_number = number
}
to
Joint(...) : _number(number){}
I didn't know this is different. I thought it is just another way to write it.
So it seems to work by passing the objects correctly as I was hoping.
J-M-L
Yes could do but that exposes all the details OP might have wanted to hide (ie just instantiate a body and you are done, no need to know what’s underneith)
Exactly this is what I try to achieve by OOP. It's just not that simple with some hardware-components.
I also tried to give a reference of Body to the Joints. This way the joints could grab the pwm for themself. But I think this would end up in a bigger mess. Plus it would increase coupling even more.