Oop Discussion | Sololearn: Learn to code for FREE!

+1

Oop Discussion

Ok so this is not a question but a discussion. And the question that arises is why use Private and Public Classes(used in many languages)

9/10/2020 10:44:52 AM

Kunsh-Tyagi

2 Answers

New Answer

+2

public classes are the default in most languages I know. It basically means that any non private(and non protected) attribute or method is accessible by any other class. A private class is not visible to any class. It is therefore useless except if it is an inner class. Classes can usually "see" their inner classes whether it is private or not. I am yet to know a good use case for private/protected classes yet.

+2

@ore same here do tell here if you find out ;)