Skip to content

Instantly share code, notes, and snippets.

@shigemk2 shigemk2/accessor.ts
Created Feb 23, 2015

Embed
What would you like to do?
class A {
private message: string;
set sample(str: string) { this.message = str; }
get sample(): string { return this.message; }
}
var b = new A();
console.log(b.sample);
b.sample = "two accessor";
console.log(b.sample);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.