Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Aug 19th, 2012  |  syntax: None  |  size: 0.41 KB  |  hits: 4  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. //Mixing traits in type definition
  2. class DoublePlusOneQueue extends IntQueueImpl with Incrementing with Doubling
  3.  
  4. object FilaComTrait extends App {
  5.   val queue1 = new DoublePlusOneQueue
  6.   queue1.put(1)
  7.   queue1.put(2)
  8.   println(queue1.get())
  9.   println(queue1.get())
  10.  
  11.   //Mixing traits in object instantiation
  12.   val queue2 = new IntQueueImpl with Filtering
  13.   queue2.put(-1)
  14.   queue2.put(1)
  15.   println(queue2.size())
  16. }