Static members will be accessed independent of objects of class.
The features of static class are: 1. They only contain static members.
2. They cannot be instantiated.
3. They are sealed. (Cannot be inherited)
Creating a static class is therefore much the same as creating a class that contains only static members and a private constructor. A private constructor prevents the class from being instantiated.
Sai Krishna said
A static class is a class of all static members.
Static members will be accessed independent of objects of class.
The features of static class are:
1. They only contain static members.
2. They cannot be instantiated.
3. They are sealed. (Cannot be inherited)
Creating a static class is therefore much the same as creating a class that contains only static members and a private constructor. A private constructor prevents the class from being instantiated.
KC said
I think the above answer holds good for C#. I don’t think this hold good for C++.
C++ only allows you to have static members inside a class when declared explicitly for each member.
Static keyword declared for a class doesnot have any affect on on its members in C++.