Class attribut PwmOut does not works


I am trying today to create a class called myClass. In this class I have a PwmOut pointer declared as: PwmOut* my_pwm. In my class constructor I do

this->my_pwm = new PwmOut(D9);

Then in my main i instantiate my class like this:

int main(void) {

myClass toto;

while (true) { wait(8); } //wait to be sure the program does not exit

return 0;

But when I plug the scope to see the pwm on my pin… Nothing works, just a LOW state…

Moreover, if I do it without class like this, it works:

int main(void) {
PwmOut my_pwm(D9);

while(true) {wait(8);}

return 0;

Maybe I miss something, but I don’t see my error. Do you have any idea ?