Reference Usage

G

Guest

From the tests that I've run using references, it appears as if the below is
true...is this the case:

dim c as new myclass()
dim b as Class
b=c
dim c as new myclass()

When I then change properties in c, they are not reflected in b since b
contains a reference to the first instance of the object myclass created and
not to c which now contains a second instance of the object myclass...is this
correct?
 
A

Armin Zingler

Dennis said:
From the tests that I've run using references, it appears as if the
below is true...is this the case:

dim c as new myclass()
dim b as Class
b=c
dim c as new myclass()

When I then change properties in c, they are not reflected in b
since b contains a reference to the first instance of the object
myclass created and not to c which now contains a second instance of
the object myclass...is this correct?



Correct.



Armin
 
C

Chris

Dennis said:
From the tests that I've run using references, it appears as if the below is
true...is this the case:

dim c as new myclass()
dim b as Class
b=c
dim c as new myclass()

When I then change properties in c, they are not reflected in b since b
contains a reference to the first instance of the object myclass created and
not to c which now contains a second instance of the object myclass...is this
correct?

Yep you are correct.

Chris
 
C

Cor Ligthert [MVP]

Dennis,

See my sample in your other question thread.
And please don't multipost the same kind of questions, when the thread is
obviously still open.

Cor
 
G

Guest

It's NOT the same question. My other question was regarding passing byVal
versus byRef. This thread is about a completely different
question!!!!!!!!!!!!!!!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top