TypeScript

TypeScript

interface IPerson {
  firstName: string;
  lastName: string;
}

class Person implements IPerson {
  getFullName() {
    return this.firstName + ' ' + this.lastName;
  }
}

class Pilot extends Person {
     constructor(public firstName: string, public lastName: string) {}
}

class Sailer extends Person {
     constructor(public firstName: string, public lastName: string) {}
}

const pilot = new Pilot("Joe", "Alpha")
const sailer = new Sailer("Jane", "Beta")

console.log(pilot.getFullName())
console.log(sailer.getFullName())