hi all i am confused const long size =((long)int.Maxvalue+1)/4 how i interprate it…
and what will happen when we define static const long size =((long)int.Maxvalue+1)/4…
what is readonly member….
hi all i am confused const long size =((long)int.Maxvalue+1)/4 how i interprate it… and
Share
const
A constant member is defined at compile time and cannot be changed at runtime. Constants are declared as a field, using the const keyword and must be initialized as they are declared. For example;
can’t declare a member of class as “static const”.
PI cannot be changed in the application anywhere else in the code as this will cause a compiler error.
readonly
A read only member is like a constant in that it represents an unchanging value. The difference is that a readonly member can be initialized at runtime, in a constructor as well being able to be initialized as they are declared.
For example: