reference question

  • Thread starter Thread starter Hei
  • Start date Start date
H

Hei

hi,

dim a as objectA = new objectA
dim b as objectA
b=a ' what the thing in b? is here say b is a reference ?
a=b ' what the thing in a?

Hei.
 
I assume, "objectA" is a class name.
dim a as objectA = new objectA
dim b as objectA
b=a ' what the thing in b? is here say b is a reference ?
a=b ' what the thing in a?

b=a:
The reference in a is copied and stored in b. After the assignment, a and b
reference the same object.

a=b:
The reference in b is copied and stored in a. Before and after the
assignment, a and b reference the same object, so the assignment is
superfluous.
 
* "Hei said:
dim a as objectA = new objectA
dim b as objectA
b=a ' what the thing in b? is here say b is a reference ?

'b' references the same object as 'a' does.
a=b ' what the thing in a?

'a' already references the same object as 'b', so this assignment is
useless.
 
Back
Top