O'Reilly logo

C# Primer: A Practical Approach by Stanley B. Lippman

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

2.9. static Class Members

Not all members of a class make sense as instance members. Some members provide a service or contain information that is independent of an individual class object. The current value of an integer, for example, is an instance member. The maximum value an integer can hold is not. It holds true for all integer objects.

We would not want each integer object to hold a copy of the maximum value an integer can hold. However, it is information that users of the integer type would like to retrieve and to compare individual instances against.

That is, the maximum integer value makes sense as a member of the class representing the integer type. It does not make sense as an instance member of that class. This is why we declare certain ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required