how to keep a reference to an object?

  • Thread starter Thread starter buu
  • Start date Start date
B

buu

It's dummy question, I know, but wanna be sure...

is this a proper way to keep a reference to an object:


public class Class1

private o1 as Object1
public sub New(byref vO as object1)
o1=vO
end sub
end class



on this way we keep just a reference to a object (32-bit) or we create a new
one?
 
on this way we keep just a reference to a object (32-bit) or we create a new

You just copy the reference, no new object is created (assuming
object1 is a reference type). There's no need to make v0 a ByRef
parameter.


Mattias
 
how do you mean that 'there's no need to make a byref param'?

I mean your code will work just as well (and the code will make more
sense IMO) if you change

public sub New(byref vO as object1)

to

public sub New(byval vO as object1)


Mattias
 
Back
Top