R
Rob Nicholson
How do you handle references to a variable in VB.NET? Consider something
like this:
Public Class MyClass
Private m_Widget As MyWidget
End Class
I realise that if you do something like:
m_Widget = New MyWidget
The m_Widget holds a reference to the new MyWidget object. If you then do
something like:
Dim m_Reference As MyWidget = m_Widget
Then m_Reference now holds a reference to the same MyWidget object.
However, what I want is the equivilent of the C++ ** mechanism whereby
m_Reference is actually a reference to the m_Width reference if you see what
I mean So that if the m_Width variable is changed to another object,
then the m_Reference also changes.
In C++ (which I'm real rusty on), I would have done something like:
Widget *m_Widget, **m_Reference;
m_Widget = New Widget;
m_Reference = &m_Widget;
Sorry if that's a real mixture - ages since I wrote a line of C++! And I
know I'm mixing pointers and references.
Thanks, Rob.
like this:
Public Class MyClass
Private m_Widget As MyWidget
End Class
I realise that if you do something like:
m_Widget = New MyWidget
The m_Widget holds a reference to the new MyWidget object. If you then do
something like:
Dim m_Reference As MyWidget = m_Widget
Then m_Reference now holds a reference to the same MyWidget object.
However, what I want is the equivilent of the C++ ** mechanism whereby
m_Reference is actually a reference to the m_Width reference if you see what
I mean So that if the m_Width variable is changed to another object,
then the m_Reference also changes.
In C++ (which I'm real rusty on), I would have done something like:
Widget *m_Widget, **m_Reference;
m_Widget = New Widget;
m_Reference = &m_Widget;
Sorry if that's a real mixture - ages since I wrote a line of C++! And I
know I'm mixing pointers and references.
Thanks, Rob.