'in' storage class

Nathan Reed nathaniel.reed at gmail.com
Wed Sep 5 13:12:31 PDT 2007


Funog wrote:
> void testFinal(final int[] foo)
> {
>     foo[0] = 10;        //OK
>     foo = new int[20];  //ERROR
> }
> void testConst(const int[] foo)
> {
>     foo[0] = 10;        //ERROR
>     foo = new int[20];  //ERROR
> }
> void testFinalConst(final const int[] foo)
> {
>     foo[0] = 10;        //ERROR
>     foo = new int[20];  //ERROR
> }
> 
> 
> So what is the difference between 'const' and 'final const' ?
> 

I suppose there's no practical difference in that case since you're 
using the transitive const.  Note that final const(int)[] foo is 
different from const(int)[] foo though.

Thanks,
Nathan Reed


More information about the Digitalmars-d-learn mailing list