diff options
Diffstat (limited to 'tests/examplefiles/example.ts')
-rw-r--r-- | tests/examplefiles/example.ts | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/examplefiles/example.ts b/tests/examplefiles/example.ts new file mode 100644 index 00000000..545c6cf5 --- /dev/null +++ b/tests/examplefiles/example.ts @@ -0,0 +1,28 @@ +class Animal { + constructor(public name) { } + move(meters) { + alert(this.name + " moved " + meters + "m."); + } +} + +class Snake extends Animal { + constructor(name) { super(name); } + move() { + alert("Slithering..."); + super.move(5); + } +} + +class Horse extends Animal { + constructor(name) { super(name); } + move() { + alert("Galloping..."); + super.move(45); + } +} + +var sam = new Snake("Sammy the Python") +var tom: Animal = new Horse("Tommy the Palomino") + +sam.move() +tom.move(34) |