0

Casting to ref.

Is there any different to casting to a type or a type&, whats the ref. refering to? https://code.sololearn.com/cwk9z4ZsOVzk/?ref=app

26th Oct 2019, 5:17 PM
Denomycor
Denomycor - avatar
1 Odpowiedź
0
Replace the second line by- int &x2 = x1; This will give you the same output. It just means that you have created a reference for x1. It means now you can access the value 2 with the help of two variables x1 and x2.
3rd Nov 2019, 10:44 AM
Avinesh
Avinesh - avatar