❔ Can separate class objects contain instances of the same method object
So if I have multiple objects of the same class, with a particular member object that is in itself a class, can those separate class objects all refer to the same object when referring to their own member object, similar to how a pointer would work?
4 Replies
the way you're phrasing it is confusing, but generally yes you can think of reference types as working similar to pointers
will make
obj1
and obj2
refer to the same actual objectyes, reference types work kinda-sorta like pointers
So
will have both
barA
and barB
have the exact same reference to foo
(since we're talking about pointers, i think it could be worth mentioning
ref var obj3 = ref obj1;
)Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.