In OOP why need to put something Private , for example. I know that any private member can not be accessed but with the same class objects. But why I need to do that while I am the only coder of my project. The same question extends to Protected, protected from who!
In OOP why need to put something Private , for example. I know that
Share
privateandprotectedare not there to prevent other coders from accessing the internals of a class, but (also) to prevent yourself from creating a program without clearly defined interfaces.If every class in your project can modify every other class, you’re not only prone to introduce bugs because of the huge state space, but also preventing yourself from: