Возможно ли выполнить код после наследования родительского класса? Устранение необходимости инициализировать дочерний класс.
После того, как я возился с собой и провел неделю поисков, я вышел пустым.
// This works, its will add the class in the registry array
let registry = [];
class Parent {
constructor() {
registry.push(this)
}
}
class Child extends Parent {
}
let child = new Child();
// What i wish i could do, note that the final line of code is removed.
// Removing the line stops the program from adding the class to the array,
// is it possible to achieve the same result as above without that line?
let registry = [];
class Parent {
constructor() {
registry.push(this)
}
}
class Child extends Parent {
}