Final (Java): Difference between revisions

Content deleted Content added
m Reverted edits by 12.5.79.251 (talk) to last version by 84.70.206.36
Line 132:
Another C++ parallel is <code>SomeClass * const ptr</code> where the contents being referenced can be modified, but the reference itself can not without casting. This is different from the C++ <code>const SomeClass * ptr</code> where the contents cannot be modified without casting, but the reference itself can.
 
C++ const is a soft guideline and it can easily be overridden by the programmer; the programmer can easily cast a const reference to an unconst reference. Java's final is a strict rule such that you can't write a valid code that compiles , breaks or simply bypasses the final restrictions.
 
== References ==