+ 2

what is the difference between public and private class?

12th Oct 2016, 4:48 PM
Nirmal Chandra Panda
Nirmal Chandra Panda - avatar
6 odpowiedzi
+ 4
In public classes all other classes in the main() can access data defined in it. Whereas private is used to restrict access only to a specific initiallised Data. For eg when making a game it is more secured to define the lives counter as private than public since a leakage or bug can result in midifiction of the lives. Get it?
12th Oct 2016, 5:23 PM
THE.GEEK
THE.GEEK - avatar
+ 3
Public means it can be used in another class also but private means it's belongs to that particular class only hope u understood.
12th Oct 2016, 5:48 PM
Shabeena Taj
Shabeena Taj - avatar
+ 3
Private is secured and thus used when we have to restrict the access of class. But if u want keep it for open access then public is used.
14th Oct 2016, 11:54 AM
Aniket kinhikar
Aniket kinhikar - avatar
+ 2
you can not access a private class from other classes whereas you have the access to a public class from everywhere.
5th Nov 2016, 11:13 PM
Mowlana
Mowlana - avatar
+ 1
thanks
12th Oct 2016, 5:26 PM
Nirmal Chandra Panda
Nirmal Chandra Panda - avatar
+ 1
you're welcome.😸
12th Oct 2016, 5:32 PM
THE.GEEK
THE.GEEK - avatar