top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

Define Static Members in C# ?

+1 vote
219 views

Hai, friends anybody expalin Static Members in C#

posted Nov 17, 2014 by Vinitha

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

0 votes

If an attributes value had to be same across all the instances of the same class , static keyword is used.
For example if the Minimum salary should be set for all employees in the employee class, use the following code

private static double MinSalary = 30000;

To access a private or public attributes or methods in a class, at first an object of the class should be created . Then using that instance of class , attributes or methods can be accessed. To access a static variable, we don't want to create an instance of the class having the static variable. We can directly refer that static variable as shown below.

double var = Employee.MinSalary
answer Nov 17, 2014 by Manikandan J
Similar Questions
+3 votes

Hai friends anybody say about the Data Encapsulation in C#

+1 vote

Hai Friends anybody say about Function Overloading in C#.net

...