在VB.net中,如何从嵌套类中的其他函数访问类中的函数?
我在VB.net中开发,但我来自java,我有一个想法,创建一个匿名类,实现如下接口:在VB.net中,如何从嵌套类中的其他函数访问类中的函数?,vb.net,interface,nested-class,Vb.net,Interface,Nested Class,我在VB.net中开发,但我来自java,我有一个想法,创建一个匿名类,实现如下接口: int h = 4; Object x = new iInterface({ @Override void f(){ h = 5; } }); 我不知道怎么做,所以我想创建一个嵌套类来实现iInterface,但是 Class N Dim h = 4 Class n Implements iInterface Sub f()
int h = 4;
Object x = new iInterface({
@Override void f(){
h = 5;
}
});
我不知道怎么做,所以我想创建一个嵌套类来实现iInterface,但是
Class N
Dim h = 4
Class n
Implements iInterface
Sub f()
h = 5
End Sub
End Class
End Class
。。。VisualStudio在h下面放了一块蓬松的蓝色垫子,并对我说:对非共享成员的引用需要对象引用
我该怎么办?>___ 您可能正在寻找共享元素。以下是相关文件: 否则,您必须显式创建该类的实例,以便 使用它。类似这样的东西:
Class N
Shared h = 4
Class n
Implements iInterface
Sub f()
h = 5
End Sub
End Class
末级