calling multiple functions with same instance in scala

scala

Solution

How about this:

scala> val c = new Car {
     |     examineColor
     |     bargain(300)
     |     buy
     | }

Or:

scala> { import c._
     |   examineColor
     |   bargain(300)
     |   buy
     | }

Problem

is there any way I can achieve the following in scala ``` with new Car() { examineColor bargain(300) buy } ``` instead of ``` val c = new Car() c.examineColor c.bargain(300) c.buy ```

Original source