Top "Static" questions

Static is a term used in some programming languages to define a function or data storage area (field) that is not bound to any specific object instance.

static constructors in C++? I need to initialize private static objects

I want to have a class with a private static data member (a vector that contains all the characters a-z). …

c++ static private initializer static-constructor
Objective-C Static Class Level variables

I have a class Film, each of which stores a unique ID. In C#, Java etc I can define a …

objective-c variables static
Static vs class functions/variables in Swift classes?

The following code compiles in Swift 1.2: class myClass { static func myMethod1() { } class func myMethod2() { } static var myVar1 = "" } func doSomething() { myClass.…

function class swift variables static
Invoking a static method using reflection

I want to invoke the main method which is static. I got the object of type Class, but I am …

java reflection static
Volatile vs Static in Java

Is it correct to say that static means one copy of the value for all objects and volatile means one …

java multithreading concurrency static volatile
Why can't I inherit static classes?

I have several classes that do not really need any state. From the organizational point of view, I would like …

c# inheritance static
When are static variables initialized?

I am wondering when static variables are initialized to their default values. Is it correct that when a class is …

java static initialization
How to initialize a private static const map in C++?

I need just dictionary or associative array string => int. There is type map C++ for this case. But I …

c++ static map initialization constants
Stack, Static, and Heap in C++

I've searched, but I've not understood very well these three concepts. When do I have to use dynamic allocation (in …

c++ static garbage-collection stack heap
Static variables in C++

I would like to know what is the difference between static variables in a header file vs declared in a …

c++ static scope