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.

static member variable when declared private

When a static member variable is declared private in a class, how can it be defined? Suppose i have the …

c++ static-members
error LNK2001: unresolved external symbol "private: static class

error LNK2001: unresolved external symbol "private: static class irrklang::ISoundEngine * GameEngine::Sound::_soundDevice" (?_soundDevice@Sound@GameEngine@@0PAVISoundEngine@irrklang@@A) I …

c++ visual-c++ linker-errors static-members
Android static object lifecycle

I am creating event search application, we set search criteria from one screen populate in another screen then user can …

android static android-lifecycle static-members
How to instantiate a static vector of object?

I have a class A, which has a static vector of objects. The objects are of class B class A { …

c++ instantiation static-members
Can template classes have static members in C++

Can a template class in C++ have static members? Since it doesn't exist and is imcomplete before it is used, …

c++ templates static-members
constexpr initializing static member using static function

Requirements I want a constexpr value (i.e. a compile-time constant) computed from a constexpr function. And I want both …

c++ gcc g++ static-members constexpr
When to use enums, and when to replace them with a class with static members?

It recently occured to me that the following (sample) enumeration... enum Color { Red, Green, Yellow, Blue } ... could be replaced with …

c# enums polymorphism static-members
Why keyword 'this' cannot be used in a static method?

Why can't the keyword this be used in a static method? I am wondering why C# defines this constraint. What …

c# this static-members
Protected static member variables

I've recently been working on some class files and I've noticed that the member variables had been set in a …

php static protected static-members
Why does Java prohibit static fields in inner classes?

class OuterClass { class InnerClass { static int i = 100; // compile error static void f() { } // compile error } } Although it's not possible to access …

java inner-classes static-members