如何在B类中使用A类的isEmpty?
Class A{
def isEmpty = ...
Class B{
def isEmpty = ...
}
}
Run Code Online (Sandbox Code Playgroud)
试试这个:
class A {
outer =>
def isEmpty = ...
class B {
def isEmpty = outer.isEmpty
}
}
Run Code Online (Sandbox Code Playgroud)
或者:
class A {
def isEmpty = ...
class B {
def isEmpty = A.this.isEmpty
}
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
158 次 |
| 最近记录: |