What is the difference between static and const data member ?

 Posted by Pkanwar on 3/10/2013 | Category: C# Interview questions | Views: 7304 | Points: 40
Answer:

Static
1. Static member is a reference type.
2.Variable set at run time.
3.Static member can be accessed without creating instance of the class or can be
changed from many location.

Const
1.Cost member is a value type.
2.Variable set at compile time.
3.It can't be changed in the application creating instance of the class or can be anywhere else in the code.


Asked In: Many Interviews | Alert Moderator 

Comments or Responses

Login to post response