Questions tagged [static-keyword]
The static-keyword tag has no usage guidance.
8 questions
1
vote
2
answers
7k
views
Singleton pattern without static
I heard that static (in the Java sense, basically a static method is called on the class itself and not on an instance) is not True OOP. However, how would the Singleton pattern be implemented in such ...
46
votes
4
answers
63k
views
Why prefer non-static inner classes over static ones?
This question is about whether to make a nested class in Java to be a static nested class or an inner nested class. I searched around here and on Stack Overflow, but couldn't really find any questions ...
6
votes
2
answers
14k
views
Static variable - Usage and Implications on Threading
I have some confusion regarding the use of static variables/references in a class. It feels like I may not have entirely figured out the implications of keeping something static.
When I say a ...
3
votes
3
answers
4k
views
OO PHP static keyword, should I use it?
I'm writing script for fb and I have 3 objects that I'll be using through all classes. I'm wondering if there is any advantage in using the static keyword except I don't have to create an instance ...
16
votes
6
answers
52k
views
Understanding the static keyword
I have some experience in developing with Java, Javascript and PHP.
I am reading Microsoft Visual C# 2010 Step by Step which I feel it is a very good book on introducing you to the C# language.
I ...
128
votes
10
answers
111k
views
Don't Use "Static" in C#?
I submitted an application I wrote to some other architects for code review. One of them almost immediately wrote me back and said "Don't use static. You can't write automated tests with static ...
13
votes
1
answer
3k
views
Why is there no facility to overload static properties in PHP?
Intro
PHP allows you to overload method calls and property accesses by declaring magic methods in classes. This enables code such as:
class Foo {
public function __get($name) { return 42; }
}
$...
51
votes
4
answers
125k
views
Why and when should I make a class 'static'? What is the purpose of 'static' keyword on classes?
The static keyword on a member in many languages mean that you shouldn't create an instance of that class to be able to have access to that member. However, I don't see any justification to make an ...