DEV Community

Discussion on: JavaScript and Object-Oriented Programming

Collapse
 
rainerhahnekamp profile image
Rainer Hahnekamp

Hi Alexandr, thanks for mentioning but I did this on purpose to enforce encapsulation. So I don't want that anybody can access the author property except the object itself.

I am using this in prototype-based version at the end of this article and mentioned the problem with encapsulation.

Collapse
 
avalander profile image
Avalander

Still, it's entirely useless, you should add a getter or something to avoid confusing people :)

Thread Thread
 
rainerhahnekamp profile image
Rainer Hahnekamp

True, have added a getter method. Thanks for the input to both of you!

Collapse
 
oxyyyyy profile image
Alexandr Vlasenko

You're right in this case
sry :]