Top "Class-variables" questions

A class variable is a variable shared by all instance of that class.

Python Class Variable Initialization

I'd like to store some information about a class as class (static) variables. However, I can't figure out how these …

python initialization class-variables
Accessing a Class' instance variable from outside

I understand (I think) the difference between class variables and instance variables of a class in Ruby. I'm wondering how …

ruby variables instance-variables class-variables
Is final ill-defined?

First, a puzzle: What does the following code print? public class RecursiveStatic { public static void main(String[] args) { System.out.…

java final class-variables static-initialization
Class variable: public access read-only, but private access r/w

In my current project I have a class which stores its Instance in a variable. This Instance should be accesible …

java class-variables
How to access a class variable from the outside in ruby?

I'm trying to access a class variable from a method outside of the class. This is my class: class Book @@…

ruby class-variables
java singleton pattern, should all variables be class variables?

If a class implements a singleton pattern, should all the variables be declared static? Is there any reason they shouldn't …

java design-patterns static singleton class-variables
In Objective-C, is it possible to set default value for a class variable?

Is there any way to set default values for class properties of a class? Like what we can do in …

objective-c default-value class-variables
What is the significance of final instance variables?

I am having some confusion between static final class variable and final instance variable. Here is the sample code:- …

java static constants instance-variables class-variables
Inheritance of class variables in python

Trying to understand oop in python I came into this situation that puzzles me, and I wasn't able to find …

python python-2.7 inheritance class-variables
Setting new class variables inside a module

I have a plugin I have been working on that adds publishing to ActiveRecord classes. I extend my classes with …

ruby class-variables