Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialIlya Sikharulidze
Courses Plus Student 1,073 Pointspublic keyword
One thing that I don't understand about "public", "private" keywords is who are we protecting the classes from?? It's our own code, so other people can't access it anyway? Can someone please clarify
1 Answer
Steven Parker
231,198 PointsSometimes software vendors create and sell libraries to other developers, so this would be one place where this is useful.
But even if you write everything, enforcing access restrictions in the code can help prevent accidental violation of OO principles, and potential errors as a result.