In other words, if I use the new keyword to declare a variable, does it automatically apply to the entire line or just the following term? How do I know if I’m creating a reference or not?
(assume, obviously, that A is also a vector 3 or other object that can be cast to vector 3).
“new” only applies to the constructor following it. Vector3 is a struct and thus is a bad example for reference because it is always a copy.
So
Vector3 a = new Vector3(1,2,3);
Vector3 b = a;
b.x = 0;
Will still result in a.x = 1
If you just say
Vector3 c;
Then that results in the default value of (0,0,0).
c is a new Vector3.
If it were not a struct then it would be a reference.
For example, say you have a class Foo.
Foo a = new Foo();
Foo b = a;
b.field = 1;
a.field will also = 1. b is a reference to a.
This may provide further explanation:
http://www.albahari.com/valuevsreftypes.aspx