Difference between protected and private protected .
what is difference between protected and private protected access modifiers.
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Mageshwaran RRank #411 · 6.1K reputationPosted Nov 15, 2019, 12:38 AM EST
Puneet KankarRank #446 · 5.6K reputationPosted Nov 16, 2019, 5:43 AM EST
Jignesh KumarRank #91 · 22.9K reputationPosted Sep 12, 2018, 8:35 PM EDT
Pravesh Kumar166 reputationPosted Sep 12, 2018, 8:42 PM EDT
Jignesh KumarRank #91 · 22.9K reputationPosted Sep 12, 2018, 8:53 PM EDT
Jaish MathewsRank #225 · 11K reputationPosted Sep 12, 2018, 8:55 PM EDT
Daril148 reputationPosted Nov 23, 2021, 12:37 AM EST
Now let's see an example.
We have two variables in class Floor pri and pro.
The pri is declared private and the pro is declared protected.
The pri cannot be accessed in the class A. But the pro can be accessed in class B. Because to access the protected, it must be in the same assembly. The private can only be accessed by the functions inside the same class..