Wednesday, September 1, 2010

Initialising and assignment

int i =5;
i=5;
const int i =5;

int &r = i;r = 10;

Assignment can happen anywhere while initialization occurs once.
Its const which creates this difference. We can think reference as const pointers.

Java has final like this.

No comments:

Post a Comment