Good examples. I really like that you don't simply explain how to do the code, but also explains WHY we should write the code this way. Keep up the good work.
I never understand why magic getters and setters are necessary. I get that a function is more useful than a property. So write a regular method. getMessage()
Getters and Setters are just shortcuts to a getMessage and setMessage function. The biggest benefit they provide is in validation and other related "behind the scenes" processing that you don't want to bore a regular user of an object property with :P
Crystal clear explanation 👌
Good examples. I really like that you don't simply explain how to do the code, but also explains WHY we should write the code this way. Keep up the good work.
Thanks Mr. Chinnathambi
Great video , cleared all the doubts regarding the getter and setter and how useful they're.
Awesome Kirupa ❤️
Glad you liked it :-)
@@kirupa I always do it
Thanks Kirupa
Found an awesome channel. Great work man!
Love your videos. This one was exactly what I needed!
Awesome! Thank you, Blake! :P
ahaa.. great video sir .. Liked it .
This was amazing, thank you! Subscribed!
Good explanation. Can we use getters and setters without a backing property?
Absolutely! You would just ignore the value that gets passed in and have something that behaves like a function while being used like a property :-)
Thanks!
You bet! :P
I never understand why magic getters and setters are necessary. I get that a function is more useful than a property. So write a regular method. getMessage()
Getters and Setters are just shortcuts to a getMessage and setMessage function. The biggest benefit they provide is in validation and other related "behind the scenes" processing that you don't want to bore a regular user of an object property with :P
@@kirupa I agree, and also just for abstraction in general and information hiding
thx!