Answers for "is javascript support inheritance"

1

javascript inheritance

class Car {
  constructor(brand) {
    this.carname = brand;
  }
  present() {
    return 'I have a ' + this.carname;
  }
}

class Model extends Car {
  constructor(brand, mod) {
    super(brand);
    this.model = mod;
  }
  show() {
    return this.present() + ', it is a ' + this.model;
  }
}

let myCar = new Model("Ford", "Mustang");
document.getElementById("demo").innerHTML = myCar.show();
Posted by: Guest on February-17-2022
3

javascript inheritance

class Animal {
   null
}
class tiger extends Animal {
 null }
Posted by: Guest on May-15-2021
0

javascript inheritance

function Teacher(first, last, age, gender, interests, subject) {
  Person.call(this, first, last, age, gender, interests);

  this.subject = subject;
}
Posted by: Guest on February-17-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language