All Questions
10 questions
1
vote
0
answers
52
views
OOP static variable standards
I am working on a project in C++ but I can see this happening in any other Object Oriented Language. I need a static variable in a class and I am wondering if the standard rules apply to static ...
0
votes
1
answer
1k
views
Private, Static, and scope of variables in Java
In my Java class, we just learned about scope. And by learned I mean it was briefly mentioned once and never spoken of again. Some questions were posted, and I'm having trouble understanding the ...
4
votes
4
answers
5k
views
How to create a private static variable?
How can I create a private and static variable in Javascript?
var Class = function() {
this.member = ...; //Public member
var member = ...; //Private member
}
Class.member = ...; //Public ...
4
votes
1
answer
576
views
private static variables in c# and thread safety
A collegue of mine has written the following code in a multithreaded c# app...
public class1
{
private static partialClass var1 = new partialNonStaticClass();
public static method1()
{...
0
votes
2
answers
3k
views
C++ How to access private static variable in another class
I am trying to access a private static variable (*PhysicsEngine::_world->setDebugDrawer(&debugDraw);*) from another class.
First class:
namespace GameEngine
{
class PhysicsEngine
{
...
13
votes
6
answers
127k
views
Difference between public static and private static variables
class Employee{
// salary variable is a private static variable
private static double salary;
// DEPARTMENT is a constant
public static final String DEPARTMENT = "Development";
public static void ...
3
votes
4
answers
3k
views
A java class only with "private final static" variables.. Is it a good idea?
I just want to know, since I have a lot of private final static variables in my 3 classes, if It is a good idea to put them in just one classe like this :
public class Definicoes
{
/*
* ...
191
votes
20
answers
424k
views
What is the use of a private static variable in Java?
If a variable is declared as public static varName;, then I can access it from anywhere as ClassName.varName. I am also aware that static members are shared by all instances of a class and are not ...
11
votes
3
answers
16k
views
Which is better in PHP, Static Variable or Private Variable? [closed]
I noticed two ways in PHP to do the same thing. Can you tell me which way is a better programming practice?
In the first example, I use a private variable on the class. On the second example, I use a ...
19
votes
5
answers
23k
views
Java static methods accessing private variables
I was under the impression that private non-static variables could only be accessed by methods called on the object that the variables reside in, but this is not the case. Could someone please explain ...