Passing arguements by reference
- From: Andrew Bullock <andrewREMOVEbullockTHIS@xxxxxxxxxxxxxxxxxxx>
- Date: Sun, 26 Feb 2006 16:30:12 GMT
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
.
- Follow-Ups:
- RE: Passing arguements by reference
- From: David Anton
- RE: Passing arguements by reference
- From: Mark R. Dawson
- Re: Passing arguements by reference
- From: Bill Butler
- RE: Passing arguements by reference
- Prev by Date: Retrieving Desktop Icon Positions
- Next by Date: Re: Conversion signed/unsigned
- Previous by thread: Retrieving Desktop Icon Positions
- Next by thread: Re: Passing arguements by reference
- Index(es):
Loading