When you know a thing, to hold that you know it, and when you do not know a thing, to allow that you do not know it - this is knowledge. -Confucius-

Tuesday, August 6, 2013

Encapsulation - A simple approach to OOP

We wrote a class. And some other developers will use it. And somehow we want to change our class because others use it for their purposes in a way that we don't want to be. It is like there is a variable in our class and we don't want it to be less than zero , but the developers who use our class can easily change it to any value because lack of our code quality. Take a look at this code. class BadClass { ...