-1

I was learning about the static class and static method.Then i came across the following line:

Only one copy of static member exists regardless of any no of instance of a class.

what does it actually mean?

It is in the msdn document http://msdn.microsoft.com/en-us/library/79b3xss3.aspx as follows:

A non-static class can contain static methods, fields, properties, or events. The static member is callable on a class even when no instance of the class has been created. The static member is always accessed by the class name, not the instance name. Only one copy of a static member exists, regardless of how many instances of the class are created. Static methods and properties cannot access non-static fields and events in their containing type, and they cannot access an instance variable of any object unless it is explicitly passed in a method parameter.

user35
  • 468
  • 1
  • 9
  • 24

1 Answers1

0

I think the statement is phrased poorly. What it's trying to mean is that static methods are associated with classes, rather than with object instances. There's only one copy of any given class at a time - and thus one copy of the data associated with any static method - whereas multiple object instances from a class can exist, on which nonstatic methods can operate.

Warren Dew
  • 8,790
  • 3
  • 30
  • 44