Created
August 23, 2010 16:14
-
-
Save anonymous/545785 to your computer and use it in GitHub Desktop.
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
trait Cloneable[T <: Cloneable[_]] { | |
def clone(): T | |
} | |
class A(var a: Int) extends Cloneable[A] { | |
def clone(): A = new A(a) | |
} | |
class B(aa: Int, var b: Int) extends A(aa) with Cloneable[B] { | |
def clone(): B = new B(a, b) | |
} | |
/* | |
/home/james/proj/sblast/src/main/scala/clonetest.scala:9: illegal inheritance; | |
self-type B does not conform to Cloneable[B]'s selftype Cloneable[B] | |
class B(aa: Int, var b: Int) extends A(aa) with Cloneable[B] { | |
^ | |
one error found | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment