Top "Static-members" questions

A static member is a data field that is shared by all instances of a class or structure for the same program.

Please instantiate the QApplication object first

I have a static class and want it to have static QSettings. But with my initialization I get a warning: …

c++ qt static-members qapplication qcoreapplication
Static member functions

After reading sbi and Eli Bendersky's answers in this question I started to wondering what static member functions are for. …

c++ function static static-members non-member-functions
Why should I initialize static class variables in C++?

In C and C++ all static variables are initialized by default to ZERO. This is not the case of static …

c++ static-members
Is the ConcurrentDictionary thread-safe to the point that I can use it for a static cache?

Basically, if I want to do the following: public class SomeClass { private static ConcurrentDictionary<..., ...> Cache { get; set; } } Does …

c# locking static-members concurrent-collections
Are Static classes thread safe

I have gone through msdn where it is written that all the static classes are thread safe. Well that article …

.net c#-4.0 thread-safety static-members
How to define a const double inside a class's header file?

Inside the header file of my class, I am trying the following and getting compiler complaints: private: static const double …

c++ constants static-members compile-time-constant
C++ static const members overriding

Consider the following. struct A { static const int X = 1; static void printX() {std::cout << "X " << X &…

c++ static-members
static const in c++ class: undefined reference

I have a class for local use only (i.e., its cope is only the c++ file it is defined …

c++ linker static-members
Proper initialization of static constexpr array in class template?

Static class members in C++ have caused a little confusion for me due to the standard's verbiage: 9.4.2 Static data members […

c++ templates c++11 static-members constexpr
Weird undefined symbols of static constants inside a struct/class

Either I'm very tired or something weird is happening that I'm not aware of, because the code below is resulting …

c++ initialization definition static-members undefined-symbol