rsnext/examples/with-monaco-editor/code-sample.js
2020-05-18 13:21:13 -04:00

26 lines
508 B
JavaScript

export default `class Animal {
constructor(public name: string) { }
move(meters: number) {
console.log(this.name + " moved " + meters + "m.");
}
}
class Snake extends Animal {
move() {
console.log("Slithering...");
super.move(5);
}
}
class Horse extends Animal {
move() {
console.log("Galloping...");
super.move(45);
}
}
var sam = new Snake("Sammy the Python")
var tom: Animal = new Horse("Tommy the Palomino")
sam.move()
tom.move(34)`