Why and when should I make a class 'static'? What is the purpose of 'static' keyword on classes?

Posted by Saeed Neamati on Programmers See other posts from Programmers or by Saeed Neamati
Published on 2011-08-26T12:51:02Z Indexed on 2012/12/19 17:13 UTC
Read the original article Hit count: 416

Filed under:
|
|

The static keyword on a member in many languages mean that you shouldn't create an instance of that class to be able to have access to that member. However, I don't see any justification to make an entire class static. Why and when should I make a class static?

What benefits do I get from making a class static? I mean, after declaring a static class, one should still declare all members which he/she wants to have access to without instantiation, as static too.

This means that for example, Math class could be declared normal (not static), without affecting how developers code. In other words, making a class static or normal is kind of transparent to developers.

© Programmers or respective owner

Related posts about c#

Related posts about class