const and readonly

CONST AND READONLY

 

 

Const:

 

            const is a key word which cannot allow value to change in future. The const will not be static  member. Cannot change value in constructor.value evaluated at compile time.

 

readonly:

 

            readonly can change value in constructor. To use in static method should use static member. Can change value in constructor.value evaluated at runtime.

Ebook Download
View all
Diving Into OOP
Read by 16.1k people
Download Now!
Learn
View all