Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Aleksandar Prokopec
committed
May 2, 2012
1 parent
c349168
commit bafe68e
Showing
2 changed files
with
54 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
cls: bar | ||
obj: foo | ||
obj: bar | ||
cls: bar | ||
obj: bar | ||
trait: pili | ||
trait: mili | ||
trait: foo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
|
||
|
||
|
||
|
||
|
||
|
||
object dynamicObject extends Dynamic { | ||
def applyDynamic(m: String)() = println("obj: " + m); | ||
this.foo() | ||
} | ||
|
||
|
||
class dynamicClass extends Dynamic { | ||
def applyDynamic(m: String)() = println("cls: " + m); | ||
this.bar() | ||
dynamicObject.bar() | ||
} | ||
|
||
|
||
abstract class dynamicAbstractClass extends Dynamic { | ||
def applyDynamic(m: String)(args: Any*): Unit | ||
this.pili(1, new dynamicClass, "hello"); | ||
} | ||
|
||
|
||
trait dynamicTrait extends Dynamic { | ||
def applyDynamic(m: String)(args: Any*) = println("trait: " + m); | ||
def two = 2 | ||
this.mili(1,2,3) | ||
two | ||
} | ||
|
||
|
||
object dynamicMixin extends dynamicAbstractClass with dynamicTrait { | ||
this.foo(None) | ||
} | ||
|
||
|
||
object Test { | ||
|
||
def main(args: Array[String]) { | ||
val cls = new dynamicClass | ||
dynamicMixin | ||
} | ||
|
||
} |