Top "Protected" questions

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

Accessing a protected member variable outside a class

I'm querying for the ID of a field by accessing a class function which someone has already put in place. …

php class variables member protected
difference between protected and package-private access modifiers in Java?

I have seen various articles on differences between the protected and package private modifiers. One thing I found contradictory between …

java package protected access-modifiers
Why do we actually need Private or Protected inheritance in C++?

In C++, I can't think of a case in which I would like to inherit private/protected from a base …

c++ inheritance private protected c++-faq
Can I/How to... call a protected function outside of a class in PHP

I have a protected function that is defined within a certain class. I want to be able to call this …

php function call protected
What's the best way to unit test protected & private methods in Ruby?

What's the best way to unit test protected and private methods in Ruby, using the standard Ruby Test::Unit framework? …

ruby unit-testing private protected
Accessing protected method in test case using Java Reflection

Am trying to obtain and invoke a protected method residing in a different class and also different package using Java …

java reflection junit protected
"Protect" text box value from input (HTML form)

I was wondering whether it is possible to assign a value to an HTML text box and protect it. What …

html forms protected assign
Why is Java's AbstractList's removeRange() method protected?

Does anyone have any idea, why removeRange method in AbstractList (and also in ArrayList) is protected? It looks like a …

java list collections arraylist protected
Why can't my subclass access a protected variable of its superclass, when it's in a different package?

I have an abstract class, relation in package database.relation and a subclass of it, Join, in package database.operations. …

java packages access-modifiers protected
Why subclass in another package cannot access a protected method?

I have two classes in two different packages: package package1; public class Class1 { public void tryMePublic() { } protected void tryMeProtected() { } } package …

java package subclass protected modifier