Most voted "protected" questions
Protect(ed) is a form of encapsulation commonly used in object-oriented programming by restricting access to the members of an object to certain objects. This varies in every language.
Learn more…5 questions
Sort by count of
-
56
votes4
answers107040
viewsWhat is the difference between public, default, protected and private modifiers?
What are the differences between modifiers public, default, protected and private when working with inheritance? There are rules of how and when I should use them when I’m working with heritage and…
-
2
votes1
answer185
viewsHow to access a protected attribute of a package in another package?
I have the animal pack with two attributes: name and rating. package heranca; public class Animal{ protected String nome = "Leão"; protected String tipo= "Mamífero"; } ... And I have another test…
-
1
votes4
answers938
viewsPrivate or protected class in PHP
You can create a private or protected class in PHP to allow access to its variables and functions only to other specific classes? Applying: I have a class where I create a connection with the…
-
1
votes0
answers34
viewsAccessing private property with typescript Decorator
In Typescript, is it possible to access a private property from the developer? An example of the code I’ve already made class A { @dec private _teste: string = 'teste' constructor(){} public get…
-
0
votes1
answer92
viewsHow exactly does "private" and "protected" work in Ruby?
I’m studying Ruby and arrived at the access control part. I had studied before access control in Java, then I thought it would be the same, but to my surprise, the statement private and protected…