13
Reply

What is static class?

Jeetendra Gund

Jeetendra Gund

Mar 27, 2014
2.8k
2

    A static class is basically the same as a non-static class, but there is one difference: a static class cannot be instantiated. You access the members of a static class by using the class name itself. For example, if you have a static class that is named UtilityClass that has a public method named MethodA,: UtilityClass.MethodA();Use of static class: A static class can be used as a convenient container for sets of methods that just operate on input parameters and do not have to get or set any internal instance fields. For example, the static System.Math class contains methods that perform mathematical operations, without any requirement to store or retrieve data that is unique to a particular instance of the Math class. double dub = -3.14; Console.WriteLine(Math.Abs(dub)); Console.WriteLine(Math.Floor(dub)); Console.WriteLine(Math.Round(Math.Abs(dub)));// Output: // 3.14 // -4 // 3 A static constructor is only called one time, and a static class remains in memory for the lifetime of the application domain in which your program resides. Main features of a static class: • Contains only static members. • Cannot be instantiated. • Is sealed. • Cannot contain Instance Constructors.

    Manju lata Yadav
    June 30, 2014
    1

    Static can execute without main

    Mukesh Kumar
    September 05, 2017
    0

    1. A static class is a class which cannot be instantiated. 2. A static class can have only static members. 3. Static members of a class can by accessed by dot(.) operator. for example Employee.GetEmployee() 4. Static class is implicitly sealed. Therefore a class cannot inherit a static class.

    Anil Jha
    March 02, 2016
    0

    Static class is a class which cannot be instantiated.The common properties can be declared in Static class.Ex : In a school, 10 students have the same common features.So we can keep the common properties in the Static class.

    satish kumar
    May 23, 2015
    0

    A static class is basically the same as a non-static class, but there is one difference: a static class cannot be instantiated. In other words, you cannot use the new keyword to create a variable of the class type

    Kml Surani
    April 15, 2015
    0

    Static class it a type of class whose instance can not be created. we can declare static member function , field in static class we can not create non static member function and field in a static class

    1.all the members of the class are static. 2.not possible to crate the object of the static class. 3.methods r call by name of class.method name. 4.this is a sealed one

    Sunil Gaded
    August 28, 2014
    0

    the class which doesn't need any instantiation to access its data members and methods. They can called directly by the class name.

    Ashish
    April 24, 2014
    0

    http://www.dotnetperls.com/static-class

    Munesh Sharma
    April 12, 2014
    0

    Static class is a class which is call without any instance of objects.

    Dileep Kumar Patel
    April 02, 2014
    0

    Static class is a class which is faster than instance class . Since Static class doesn't require object creation hence it is faster compared to instance class . Inheritance is not allowed on the static classes hence a static class can't act as a base class as well as derived class . regards Lok http://skillgun.com/csharp/interview-questions-and-answers

    Palle Technologies
    April 02, 2014
    0

    Features of Static class 1. Inheritance not allow. 2. Creating instance not allow. 3. Must contain only static properties , fields , constructor and methods.

    shimab alam
    April 01, 2014
    0

    A static class is basically the same as a non-static class, but there is one difference: a static class cannot be instantiated. In other words, you cannot use the new keyword to create a variable of the class type. Because there is no instance variable, you access the members of a static class by using the class name itself.. for example visit this link.. http://www.c-sharpcorner.com/uploadfile/hirendra_singh/static-classes-in-C-Sharp/

    Mukesh Kumar Tiwari
    March 27, 2014
    0