Getting Started
Diving into React
React Router and Forms
Redux
Server-side Communication
Bonus Lectures

04. Class

Topic
Materials

// Classes - Blueprint to create objects
class Vehicle {
  constructor(param1, param2) {
    this.color = param1;
    this.passenger = param2;
  }
  saySomething() {
    console.log(this.color);
  }
}
// Inheritance
// Derived Class
class Car extends Vehicle {
  constructor(numWheel, pass, color) {
    super(color, pass);
    this.wheel = numWheel;
  }
}

let obj1 = new Car(4, 6, "Yellow");
console.log(obj1);
Do NOT follow this link or you will be banned from the site!
×

Cart