what is the main differnce between const,readonly and static
Answer Posted / vijay rana
const is used to create a constant value which will be
constant throuout the class
static is used for a commaon variable for all objects, it is
not part of a object, it is a part of class, every object
will share this value,
read,
there are many situation in which we want to intialize the
value of a constat variabl at run time, in which we can have
different values for different objects, with the help of
readonly we can define the value of any object at runtime
which will not be changed later
Is This Answer Correct ? | 6 Yes | 0 No |
Post New Answer View All Answers
Why do we need private constructor in c#?
What is datasource c#?
What does static mean in c sharp?
What is the advantage of constructor?
Major difference between Basic httpbinding and WShttpbinding?
Who introduced c#?
What is the use of command builder?
What is type keyword in c#?
What is the task perform by clr?
what is the meaning of Object lifetime in OOPS
Why do we use interface in c#?
Is it possible to have different access modifiers on the get/set methods of a property?
Does a class need a constructor c#?
What are the types of assembly available
What is a Managed Code??