Top "Protected" questions

`protected` is an access specifier in object-oriented languages.

Should you ever use protected member variables?

Should you ever use protected member variables? What are the the advantages and what issues can this cause?

oop protected
How do I use Mockito to mock a protected method?

I’m using Mockito 1.9.5. How do I mock what is coming back from a protected method? I have this protected …

junit mocking mockito protected
Why we should not use protected static in java

I was going through this question Is there a way to override class variables in Java? The first comment with 36 …

java oop inheritance static protected
C++ classes (public, private, and protected)

How can classes in C++ be declared public, private, or protected?

c++ private public protected access-modifiers
Inheritance of private and protected methods in Python

I know, there are no 'real' private/protected methods in Python. This approach isn't meant to hide anything; I just …

python inheritance methods private protected
Java reflection - access protected field

How can I access an inherited protected field from an object by reflection?

java reflection field protected
Unit testing C# protected methods

I come from the Java EE world but now I'm working on a .Net project. In Java when I wanted …

c# .net unit-testing protected
How to protect classes so they are not visible outside their package

I'd like to be able to have two "protected" classes in my package. That is, I do not want files …

java class protected
JavaDoc for private / protected methods?

Should I write JavaDoc for private or protected methods? And what about private variables? I see class examples on my …

java javadoc private protected
What does the protected modifier mean?

I am reading the book The Java Programming Language, 3rd edition. In chapter 3.5 , it illustrates the protected modifier with the …

java protected access-modifiers