I have done this in JAVA some time ago, I had some classes:
-defaultprinter.java
-hpprinter.java
-epsonprinter.java
...
the defaultprinter.java class has a method that can be different on each printer
public void serial() {
get-serial-depending-on-brand-method()
}
then I have a method that will select what printer to select
if(brand.equals("hp"){
printer = new hpprinter()
} ...
How can I do this with Javascript? I want to have every printer splited in separated files
-defaultprinter.js
-hpprinter.js
-epsonprinter.js
...
How can I have the common and overridable method
const serial = () => {
get-serial-depending-on-brand-method()
}
And how can I select the printer that I want?
if(brand == "hp") {
printer = ??????
} ...
Thanks for the help :D