Code QuizIntermediate

Instantiating an Abstract Class

Recognizing why you cannot create an instance of an abstract class directly.

Codetypescript
abstract class Shape {
  abstract area(): number;
}

class Circle extends Shape {
  constructor(private r: number) {
    super();
  }
  area(): number {
    return Math.PI * this.r * this.r;
  }
}

const s = new Shape();
console.log(s.area());

What is the bug in this code?