问题描述
我需要知道我是否可以在VB.NET中有一个指针指针
给予
类CClass
''声明
结束课
然后
Sub MySub()
Dim MyClass as CClass
End Sub
MyClass是CClass对象的指针。
我需要的是一个指针指针...
我的问题是如果我这样做
Dim MyClassA as CClass
Dim MyClassB作为CClass
MyClassA = Object1
MyClassB = MyClassA
它只是复制MyClassA引用的地址,MyClassB
i希望MyClassB在可能的情况下指向MyClassA的地址
每当我在新的东西上重新命名MyClassA时, MyClassB将在同一个新对象上指向
。如果我将MyClassA重新设置为新的
对象,MyClassB仍将指向第一个对象。这很容易用C / C ++来实现... b / b
继承人看起来像它的样子:
Dim MyClassA as CClass
Dim MyClassB as CClassPointer
MyClassA = Object1
MyClassB = MyClassA''MyClassB points在MyClassA,而不是指向
MyClassA指向的内容
MyClassA = Object2''现在MyClassA和MyClassB指向新对象
i need to know if i can have a pointer to a pointer in VB.NET
given
Class CClass
''declarations
End Class
and then
Sub MySub()
Dim MyClass as CClass
End Sub
MyClass is a ''pointer'' to a CClass object.
what i need is a pointer to a pointer...
my problem is that if i do this
Dim MyClassA as CClass
Dim MyClassB as CClass
MyClassA = Object1
MyClassB = MyClassA
it simply copies the address that MyClassA refers to, to MyClassB
i want MyClassB to point to the address of MyClassA if possible
this way whenever i repoint MyClassA at something new, MyClassB will point
at the same new object. the way it is above, if i reasign MyClassA to a new
object, MyClassB will still point at the first object. this is really easy to
do in C/C++...
heres something like what it could look like:
Dim MyClassA as CClass
Dim MyClassB as CClassPointer
MyClassA = Object1
MyClassB = MyClassA ''MyClassB points at MyClassA, instead of pointing at
what MyClassA points at
MyClassA = Object2 ''now both MyClassA, and MyClassB point at the new object
推荐答案
这篇关于指针指针?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!