47
Reply

What is the advantage of static class over class ?

Ujjval Shukla

Ujjval Shukla

Jan 29, 2016
14.6k
3

    In simple way we van say for accessing static class don't need to create instance and for normal class need to create instance

    Vinay Singh
    June 08, 2016
    3

    http://www.codeproject.com/Articles/891433/Must-Remember-Key-Concepts-to-Keyword-StaticAbove URL solves almost all queries related to static.

    nitin patil
    March 30, 2016
    2

    Static class members not a change values in using child class method and fiction. Static class does not allow user to create instances of the class. as well as it restrict the user to inherit any data members/functions to derived class. So, imagine a situation where we dont want a user to create instance of class or dont want user to inherit it to child class.and this class data not use child class inherit but data members/functions in child class and not a changes of a data in using child class

    jayesh vaghasiya
    March 05, 2016
    2

    by using static class we dont need to create object of that class. we can easily access method of that class. genrally we used static class to write helper methods

    Avinash Avate
    December 28, 2016
    1

    The following list provides the main features of a static class:Contains only static members.Cannot be instantiated.Is sealed.Cannot contain Instance Constructors.

    Ravi Chandra Yadav
    November 18, 2016
    1

    No need to create object to access meber of static class.

    Rajendra Mote
    August 26, 2016
    1

    In simple way we van say for accessing static class don't need to create instance and for normal class need to create instance

    Vinay Singh
    June 08, 2016
    1

    In simple way we van say for accessing static class don't need to create instance and for normal class need to create instance

    Vinay Singh
    June 08, 2016
    1

    static class does not require any object to call any function or attribute

    kapil kumar
    June 07, 2016
    1

    A static class can make your implementation simpler and faster because you do not have to create an object in order to invoke its methods. It is useful to organize the methods inside the class in a meaningful way, such as the methods of the Math class in the System namespace.

    Vivek Kumar
    February 07, 2016
    1

    Static class does not allow user to create instances of the class as well as it restrict the user to inherit any data members/functions to derived class. So, imagine a situation where we dont want a user to create instance of class or dont want user to inherit it to child class. one should go with Static class.

    Anil Kumar Murmu
    February 02, 2016
    1

    No need of creating instance for static class is the major advantage.

    Ayappan Alagesan
    February 12, 2017
    0

    Compiler ensure that no one can create object of static class. Static class are fast in comparison of simple class because no object needed. Static class behave like sealed classes no one can inherit the.Fore more properties you can visthttps://interview-preparation-for-you.blogspot.in/2011/09/static-class.html

    Khaleek Ahmad
    February 03, 2017
    0

    static classes are meant to provide common functionalities and properties. The main advantage is that we need not to create any object in order to access these. All the members under it works like global for all the other classes.

    Vineet Kumar
    January 13, 2017
    0

    I don't see a reason that we should try to see advantages of Static Class over Instance Class. They are two different things that their members can be accessed with or without an instance of a class. Just because you don't need an instance, it doesn't mean it's an advantage. If I need to know the possible ways from one source to another destination then there are multiple possibilities then it makes sense to have Instance Class to store all the routes. And if I am just returning the addition of two numbers then I don't need an instance to store a result. e.g Math class in .NET Framework.

    Kshamesh Atnoorkar
    January 05, 2017
    0

    A static class doesn't require a instance as like normal class for accessing class members.

    Srikanth Reddy
    December 07, 2016
    0

    static class runs automaticall by just accessing with class name , and normal class need to initialized by object

    Manav Pandya
    November 28, 2016
    0

    If your class doesn't store any state, then use a Static class.If it stores state and you require a single instance, then (maybe) use a Singleton.Otherwise use a regular class

    Thennarasu N
    October 20, 2016
    0

    If your class doesn't store any state, then use a Static class.If it stores state and you require a single instance, then (maybe) use a Singleton.Otherwise use a regular class

    Thennarasu N
    October 20, 2016
    0

    Static class is a pre compiled class so it can access directly without compiling run time.

    Chirag Solanki
    October 05, 2016
    0

    If you are using Static class then no need to Create Class instance. and one more thing Static class only take Static Method Ex- using System; public static class staticclass {public static void show(){Console.WriteLine("Hello");}static void Main(){staticclass.show();} }

    Dinesh Kumar
    August 31, 2016
    0

    If you are using Static class then no need to Create Class instance. and one more thing Static class only take Static Method Ex- using System; public static class staticclass {public static void show(){Console.WriteLine("Hello");}static void Main(){staticclass.show();} }

    Dinesh Kumar
    August 31, 2016
    0

    In the main method we can directly access the static members because main method is also a static method where as we have to create instance to consume the member of instance class.

    Sandeep Singh
    August 18, 2016
    0

    Static class can contain only static member in it, So there is no need to create the instance of the static class to consume the members.

    Sandeep Singh
    August 14, 2016
    0

    in case of static class you dont need to create an instance

    Soumalya Das
    August 07, 2016
    0

    when we want to access members of class without creating objects, static class may be used. The advantage of static class over class is that in static class members can be directly access by classname.membername but in class we need to create instances for accessing members of class.

    Shailendra Saxena
    July 25, 2016
    0

    We don't need to create Objects we can directly call static class methods you can use extension methods.We can use it if you are using the classes frequently.

    The best approach is to rephrase the question to: when to use static class or concrete class. The answer is it depends on the application. For example a hammer does not have an advantage over a screwdriver. It depends on the work.Look at the application from an OOP perspective. Look up the characteristics of classes on the Microsoft developers site. Then ask yourself how your software will represent the information. Is the information unique? What is the scope? Performance concerns? Organization of methods? Best wishes

    Jorge Anzardo
    July 05, 2016
    0

    The best approach is to rephrase the question to: when to use static class or concrete class. The answer is it depends on the application. For example a hammer does not have an advantage over a screwdriver. It depends on the work.Look at the application from an OOP perspective. Look up the characteristics of classes on the Microsoft developers site. Then ask yourself how your software will represent the information. Is the information unique? What is the scope? Performance concerns? Organization of methods? Best wishes

    Jorge Anzardo
    July 05, 2016
    0

    1) If you are using a static class , you do not need to create instance for accessing it's properties and methods. 2) Basically static classes are used to make Utility methods (Utils).

    Deeksha Pandit
    July 04, 2016
    0

    Static members are managed by CLR

    Bineesh VP
    June 23, 2016
    0

    In the simple way can say that no need to create instance in static class and it is mandatory in class.

    Omendra Gangwar
    June 15, 2016
    0

    static classes can'nt be instantiated bcoz static calsses is a sealed class we can'nt create the object by using create the object only instatnce variables

    hari ratnam
    June 09, 2016
    0

    static class can'nt be instatntiated bcoz static classes are sealed class we can'nt create the object by using create the object only instance variables

    hari ratnam
    June 09, 2016
    0

    In simple way we van say for accessing static class don't need to create instance and for normal class need to create instance

    Vinay Singh
    June 08, 2016
    0

    Static Class is no object of static class can be created and must contain only static members

    Thiruppathi R
    May 25, 2016
    0

    Static Classes have only one object life,Hence we cannot create multiple objects of static classes but normal classes can be instantiated for creating many objects of the same class We use Static classes in scenarios in like creating a utilities class, implementing a singleton pattern etc.

    Tijo Joy
    April 28, 2016
    0

    Static classes are used for 1) Data Caching: e.g- List of Country or States 2) Utility Classes: e.g.- You can create Utility classes as static as there is no need of creating object of these classes. 3) You Can Access methods / variables of Static class without creating object of the class. 4) These Classes are loaded when application is loaded in memory.

    Rahul Chavan
    April 06, 2016
    0

    Static classes are used for 1) Data Caching: e.g- List of Country or States 2) Utility Classes: e.g.- You can create Utility classes as static as there is no need of creating object of these classes. 3) You Can Access methods / variables of Static class without creating object of the class. 4) These Classes are loaded when application is loaded in memory.

    Rahul Chavan
    April 06, 2016
    0

    When all members/porperties in a class are static then use declare a class as static When you wnat to maintain the unique value for a varible for multiple threads then use Static

    satya srinivas
    April 05, 2016
    0

    Static class is a class with only one instance.Used for building utility codes and singleton architecture.

    Sunil Babu
    April 02, 2016
    0

    By declaring a method using the static keyword, you can call it without first creating an object because it becomes a class method that belongs to a class rather than an object.

    Keerthi Venkatesan
    March 31, 2016
    0

    static classes are used when a class provides functionality which is not specific to any instance. If you want an object to be shared between multiple instances you will use a static class. they can not be instantiated , it can not be inherited, it can have only static members it can have only static constructor.

    vaibhav Hedaoo
    March 25, 2016
    0

    Class : To access any members of the class we need to take the help of the instance. Static Class : No need to create instance. Directly with the help of class name we can access the members.

    Srikanth Reddy
    March 08, 2016
    0

    Static class does not allow user to create instances of the class as well as it restrict the user to inherit any data members/functions to derived class. So A static class can make your implementation simpler ,safe and faster because you do not have to create an object in order to invoke its methods.

    Pankaj Kumar Choudhary
    February 09, 2016
    0

    A static class can make your implementation simpler and faster because you do not have to create an object in order to invoke its methods. It is useful to organize the methods inside the class in a meaningful way, such as the methods of the Math class in the System namespace.

    Munesh Sharma
    February 09, 2016
    0

    1.)When we have a normal class and its methods being used very frequently in a given app, then it would speed up things if we made this class a static class with static methods. This is because there is always a cost incurred in terms of resource usage ( CPU, memory, time) EVERY TIME a normal class is instantiated, whereas for static class its only a ONE-TIME cost when static constructor is FIRST called.2.)The main advantage of Static Classes come when there is a need to use WebMethod or a webservice, so that the application can call the static method without creating an object.http://www.geekinterview.com/question_details/89408http://www.geekinterview.com/talk/15090-why-we-create-static-class-c.html

    Ujjval Shukla
    January 29, 2016
    0