+ 2
what is the different between private and public?
2 Answers
+ 4
private and public are access modifiers
there is only one difference between them
that is:
when you declaref member as public then it can be accessed with in and out side of the class.
and
when you declared member as private then it can be accessible only within the class when you try to access outside of the class then it gives an error.
+ 1
private only can be accesed within the class.
public can be accesed by another class