Public vs private distinctions in OOP [duplicate]

This question already has an answer here:

What’s the point of a public method? If a method m is defined within class C, then can’t we only call m on C anyway?

What’s the point of a private variable?

Source: oop

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.