Questions tagged [static-variables]

In object oriented programming, a static variable is a variable which belongs to the class and not to object(instance) & a single copy to be shared by all instances of the class.

In object oriented programming, a static variable is a variable which belongs to a class rather than to a particular instance of the class.

799 questions
-5
votes
1 answer

Change the value of a static variable

How can I change the value of a static variable in Objective-C? Is this allowed?
Undertaker
  • 39
  • 1
  • 7
-5
votes
1 answer

Difference between static variables and static memory allocation?

I was told by an experienced C developer that the concept of Static variables was not the same as that of static memory allocation. Is this correct? If so, what is the difference between the two concepts? What is the formal definition of Static…
brice
  • 24,329
  • 7
  • 79
  • 95
-6
votes
1 answer

When do we use Class Variable, rather than using Object of class?

I am studying about static variables. They say that static variables are class variables. They gave an example like this class Bicycle{ private static int noOfBicycles = 0; } When calling this we can directly use the name of the class to call…
1 2 3
53
54