0
How can I have an abstract class and its extended classes in the same file?
for example: in forms.js
class default {
constructor(width){
this.width = width
}
area(){
return this.width ** 2
}
}
module.exports = class cubo extends default {
some unique stuff for cube...
}
How can I create a cube reference in my index.js? I’ve already tried:
const formas = require('./formas.js')
const cubo = new Cubo(width)
and tried that too:
const formas = require('./formas.js')
const cubo = new formas.Cubo(width)
What I’m doing wrong?
Welcome to the Stackoverflow in Portuguese. As the name suggests, the official language used here is Portuguese. So, could you please translate your question? If you prefer, you can also ask the same question on Stackoverflow website in English.
– Jakson Fischer
You can’t export like this and also what reason is it, where are you doing it? It lacks a lot of context
– novic
This answers your question? Javascript: Differences between import and require
– Augusto Vasques