class A {
constructor() {}
}
class B extends A {
constructor() {
super();
}
}
class C extends B {
constructor() {
super();
}
}
function onInit() {
const c = new C();
}
Hi, I have a problem, which could be boiled down to the code snippet given above.
If I run it on my Espruino WiFi (2v16), I get a recursion error, since if class B tries to call the constructor of A, it calls its own constructor.
Does anyone has a workaround for this problem? I already tried passing different argument lists into the constructors to make them distinguishable (in C++ mapping terms at least). Without any luck. I can easily instantiate B or A, but not C.
I would really appreaciate your help. Thank you very much.
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
Hi, I have a problem, which could be boiled down to the code snippet given above.
If I run it on my Espruino WiFi (2v16), I get a recursion error, since if class B tries to call the constructor of A, it calls its own constructor.
Does anyone has a workaround for this problem? I already tried passing different argument lists into the constructors to make them distinguishable (in C++ mapping terms at least). Without any luck. I can easily instantiate B or A, but not C.
I would really appreaciate your help. Thank you very much.