Here is a patched version of the code:
object AbLanguage {
def a = new AfterABase
protected class AfterBBase {
def b = {}
}
protected class AfterABase extends AfterBBase {
def a = new AfterA[AfterBBase](this)
}
protected class AfterB[T](sourroundingExpression : T) {
def b = sourroundingExpression
}
protected class AfterA[T](sourroundingExpression : T) extends AfterB[T](sourroundingExpression) {
def a = new AfterA[AfterB[T]](this)
}
def main(args : Array[String]) : Unit = {
a b;
((a a) b) b;
a.a.b.b;
}
}
The return type of method a() itself allows a further call of a(), instead of that the enclosed type does not have a method a().
No comments:
Post a Comment