A pragmatic view on private vs public

Posted by Denis Gorbachev on Stack Overflow See other posts from Stack Overflow or by Denis Gorbachev
Published on 2010-03-28T18:48:49Z Indexed on 2010/03/28 18:53 UTC
Read the original article Hit count: 272

Filed under:
|
|

Hello everybody!

I've always wondered on the topic of public, protected and private properties. My memory can easily recall times when I had to hack somebody's code, and having the hacked-upon class variables declared as private was always upsetting.

Also, there were (more) times I've written a class myself, and had never recognized any potential gain of privatizing the property. I should note here that using public vars is not in my habit: I adhere to the principles of OOP by utilizing getters and setters.

So, what's the whole point in these restrictions?

© Stack Overflow or respective owner

Related posts about private

Related posts about public