+ 2
How we can use protected & private ?
as from the name guys you would know that it is related to JAVA . My question is how i can use this two keyword in any programming, cause nothing I can know, understanding, in this two part. Explain me with detail without giving any "link" to read.
4 Answers
+ 2
i need some more.
+ 2
What exact details do you want? It is access modifiers they control access :) You can decide what to hide and what to expose. It is a part of oop encapsulation principle, you can use it as you wish in terms of your app design...
+ 2
thanks @Dima
0
Normally you use private when you need to hide some variable or methods from outside world. It is done to force loose coupling between different classes and in case of external access to protect from non auth. Protect is for the same purpose but it allows you to inherit such variable or method.