EssentialTypeScriptBook icon indicating copy to clipboard operation
EssentialTypeScriptBook copied to clipboard

tip worth mentioning getters / setters

Open robin-raymond opened this issue 9 years ago • 0 comments

https://github.com/jchadwick/EssentialTypeScriptBook/blob/master/manuscript/05.Classes.md

At this point I want to point out that, even though I've been calling them "getter and setter properties" like they have to go together, this code is actually perfectly legitimate -- you don't need to define a getter AND a setter for a property - you can implement either one or both of them, depending on what you're trying to accomplish.

I believe getters and setters in C# do not allow a setter exclusively without first defining a getter. I think that is worth mentioning here as a note that it is allowed in TS (assuming it is...);

Also when I was searching the legality I read some stuff about odd property inheritance not being o

robin-raymond avatar Jun 12 '16 15:06 robin-raymond