Exercise 3: Inheritance with Cars
Explore how to implement inheritance using ES6 class syntax in JavaScript by extending a base Vehicle class with a Car subclass. Learn to define constructors, protect class properties, and create methods for setting and retrieving car details, reinforcing key concepts of object-oriented programming in JavaScript.
We'll cover the following...
We'll cover the following...
Problem Statement
In this exercise, you have to implement inheritance in between classes in the ES6 version of JavaScript.
Task 1
The base class Vehicle is declared below. You have to define its constructor. The constructor should contain: