Static Classes use..?

What is the use of static classes ?

2 Comments »

  1. 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.

  2. 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++.

RSS feed for comments on this post · TrackBack URI

Leave a Comment