Skip to content

Instantly share code, notes, and snippets.

Created October 2, 2012 15:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save anonymous/3820380 to your computer and use it in GitHub Desktop.
Save anonymous/3820380 to your computer and use it in GitHub Desktop.
properties in TypeScript
class Greeter {
greeting: string;
private _name : string;
constructor (message: string) {
this.greeting = message;
this._name = "Bob";
}
greet() {
return "Hello, " + this.greeting;
}
get name() : string {
return this._name;
}
set name(name : string) {
this._name = name;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment