Skip to content

Instantly share code, notes, and snippets.

@felipecesr
Last active March 7, 2023 13:18
Show Gist options
  • Save felipecesr/8ca34c6f12705c95ba8d5cb59bce1938 to your computer and use it in GitHub Desktop.
Save felipecesr/8ca34c6f12705c95ba8d5cb59bce1938 to your computer and use it in GitHub Desktop.
class Printer {
constructor(name) {
this.name = name;
}
}
class AllInOne extends Printer {
constructor(name) {
super(name);
}
scan() {
return 'scanning...';
}
}
function printerFunctionalities(printers) {
console.log('Impressoras digitalizando: ');
for (let printer of printers) {
console.log(`${printer.name} is ${printer.scan()}`);
}
}
let printers = [
new AllInOne('HP 1'),
new AllInOne('HP 2'),
];
printerFunctionalities(printers);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment