SHOW:
|
|
- or go back to the newest paste.
1 | - | /** I want to make use of inherited function in inner class */ |
1 | + | /** I want to make use of inherited function print() in inner class */ |
2 | class PassImplToInnerClass extends OutputterImpl { | |
3 | class Inner extends Outputter { | |
4 | // ??? is there a less tedious way to avoid this ERROR: | |
5 | // class Inner needs to be abstract, since method print in trait Outputter of type ()Unit is not defined | |
6 | def print() = PassImplToInnerClass.this.print | |
7 | } | |
8 | } | |
9 | ||
10 | trait Outputter { def print() } | |
11 | ||
12 | class OutputterImpl extends Outputter { | |
13 | def print() = println("bla") | |
14 | } |