Passing arguements by reference



Hi,

I have two classes, A and B,

B takes an A as an argument in its constructor:


A a1 = new A();
B b = new B(a1);

///

A a2;
public B(A aa)
{
a2 = aa;
}




However, I figured that I could reduce memory usage and increase performance by passing aa by reference.

How do I alter my code to do this?

I know I need to do this:

public B(ref A aa)

but how do i declare a2? If i leave it as it is, does that mean a1 and a2 both point to the same memory location, or when assigning a2 is the object copied?


Thanks

Andrew
.


Loading