Most voted "private" questions
Private is a form of encapsulation commonly used in object-oriented programming that determines that a member can only be accessed internally.
Learn more…19 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…
-
24
votes4
answers1016
viewsIs the use of "private" in C# classes optional?
What’s the difference between private string abc = ""; and string abc = "";? Is there any difference or is it just the way you write that changes? I did a test with and without the private and saw…
-
15
votes5
answers1643
viewsDifference between private and final methods
Studying methods and final classes in Deitel’s book "How to program in Java 6 ed." I came across the following proposition: The declared private methods are implicitly final because it is impossible…
-
9
votes1
answer289
viewsWhy use a private?
I’m learning variables public and private. If it is I who create all the code of the program, what is the need to create a variable private? It is enough that I do not program a code that accesses…
-
5
votes1
answer70
viewsProperty access modifier C#
I noticed that it is possible to sign a property access mode as private: public string Codigo { get; private set; } Or just ignore it: public string Codigo { get; } Is there any difference or…
-
5
votes2
answers262
viewsHow secure is my code, with private variables?
class Conta(object): def __init__(self, numero_conta, nome_titular='anonimo'): self.__nome_titular = nome_titular self.__numero_conta = numero_conta self.__saldo = 0.00 def getNomeTitular(self):…
-
5
votes1
answer302
viewsWhat happens in real life in a developer environment if the programmer does not encapsulate an attribute?
The programmer João went there and created a class Cliente and the attribute public double saldo and the method Sacar() public also. What’s wrong with leaving the attribute double saldo, after all…
oop software-engineering encapsulation getters-setters privateasked 7 years, 6 months ago user3671786 55 -
3
votes1
answer101
viewsWhy is the "private" access modifier letting me change the attribute outside the class?
Well, I have this class with the attributes private class Conta { int numero; // Atributo private double saldo; Cliente user = new Cliente(); private double limite; } From what I understood of the…
-
2
votes1
answer244
viewsPrivate class in C#
I have a class Pessoa.cs private, but I can call her in some other class, for example I created a class called Parametro.cs; I can instantiate the class private Pessoa without the slightest problem.…
-
1
votes2
answers123
viewsProperty with private set
There is a difference between declaring the set private or simply omitting it? public int UmaPropriedade {get; private set;} public int OutraPropriedade {get;} The two lines of code are equivalent?…
-
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…
-
1
votes2
answers1025
viewsAccess private attributes of a class within another class
I started studying PHPOO and I’m having difficulty accessing the attributes of the class Pessoa that are private within the class Login, follows the code class person class Pessoa { private $nome;…
-
1
votes1
answer932
viewsSyntaxerror: Private field '#attribute' must be declared in an enclosing class
I created the Employee and Director classes, being Employee Inheritor Manager(daughter), but when instantiating a Director object I got the following error: Syntaxerror: Private field '#bonus' must…
-
0
votes1
answer527
viewsHow do I download a file from a private Github repository?
Hi! All right? I’m developing a Javascript project and wanted to create a small image bank for it on Github. But I wanted to keep it private, only I don’t know how I can get the URL of an image when…
-
0
votes1
answer40
views"super" and private variables
In the case below, it makes sense to call super() in class B_Class since the variable a of A_Class is private? It would be more feasible not to use the parent-class builder? Compiling this code…
-
0
votes1
answer60
viewsPrivate encapsulation in inheritance
The class SuperSuper has an attribute of type private defined whole. Any specialization of the class SuperSuper may reset the encapsulation to public and your data is automatically converted? public…
-
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…
-
0
votes0
answers60
viewsProperty 'Foods' is private and only accessible Within class 'Mainlifecyclecomponent'
How to access private attributes within html? I created private food, but I can’t access it in html because it’s private. has some way to access? main-Lifecycle.ts import { Client } from…