$ ./guess_the_languageProgramming Languages
Programming Languages · medium · #605

Which programming language is this?

abstract class Shape {
  protected constructor(public readonly name: string) {}
  abstract area(): number;
}

class Square extends Shape {
  constructor(private side: number) { super("square"); }
  area(): number { return this.side ** 2; }
}

Answer: TypeScript

abstract class, protected/private constructor parameter properties and : number return types are TypeScript.
Play Programming Languages ▸