Which of the following is a valid implementation of an interface in a class?
interface Vehicle {
speed: number;
move(): void;
}
class Car implements Vehicle {
speed: number;
move() {
console.log(`The car is moving at ${this.speed} km/h`);
}
}
The class Car correctly implements Vehicle.
The class Car is missing the speed property.
The class Car is missing the move method.
The move method in Car has the wrong return type.
This question is part of this quiz :
TypeScript Object Oriented Programming Quiz