diff -r 10e7a90d8e7a -r a751aa1ee4f7 Fahad/CodeSamples/CompoundTypes.scala --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Fahad/CodeSamples/CompoundTypes.scala Sun Nov 09 19:25:10 2014 +0000 @@ -0,0 +1,18 @@ +package Main + +object CompoundClasses { + trait Cloneable extends java.lang.Cloneable { + override def clone(): Cloneable = { super.clone(); this } + } + + trait Resetable { + def reset: Unit + } + + def cloneAndReset(obj: Cloneable with Resetable): Cloneable = { + val cloned = obj.clone() + obj.reset + cloned + } +} +