Skip to content

Instantly share code, notes, and snippets.

@woodie
Last active December 25, 2015 18:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save woodie/fb4aeaec6d1bdf0137df to your computer and use it in GitHub Desktop.
Save woodie/fb4aeaec6d1bdf0137df to your computer and use it in GitHub Desktop.
#!/usr/bin/env typescript
class Greeter {
name: string;
constructor(name?: string) {
this.name = name || 'Nobody';
}
say_hello() {
console.log("Hello " + this.name);
}
}
var greeter = new Greeter();
greeter.say_hello();
var greeter = new Greeter('There');
greeter.say_hello();
/*
Hello Nobody
Hello There
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment