Tuesday 18 November 2014

Why is there no const keyword for methods in C# like there is for C++?

The key difficulty is verifiability at compile-time. An implementation using the [Pure] attribute has been discussed meaning the function has no side-effects; or a "getter" can be used which is effectively the same thing.

No comments: