利用該:訪問隱藏的共享/靜態變量
class outer
public shared X as string = ""
class inner
public shared sub test()
Dim s as string
s = X ' refers to the shared (static) variable in outer
end sub
end class
end class
在試驗方法的參考X是在外部類中聲明的共享變量,但是,如果我的內部類由該名稱所聲明的變量(將外部類中的共享變量切掉),我如何才能訪問它?
class outer
public shared X as string = ""
class inner
public X as string = "x"
public shared sub test()
Dim s as string
s = X ' this fails because it's an attempt to access an instance variable
end sub
end class
end class
內部類具有比其訪問私處沒有特殊關係外,其他。它將需要對外部對象的引用。 – 2013-05-04 00:09:41