'final' variables
Lionello Lunesu
lio at lunesu.remove.com
Tue Mar 20 04:10:13 PDT 2007
I've been trying to follow the thread on the const/final/invariant
extensions but I have to wonder: how useful are final variables?
final int i = 2;
This would mean: 'i' cannot be rebound to another value. Right? So this
final is actually C++'s const.
void func( final int i )
{
//i is not const but cannot be set either
}
Also here, it's like C++'s const, but with the _removed_ benefit of
restricting the accepted types. Is this correct?
What's the use of "final" for variables? I'm saying "for variables"
because for methods the benefit is only too clear.
L.
PS. I've started a new thread because this isn't a reply to any
particular post.
More information about the Digitalmars-d
mailing list