Created
August 31, 2015 18:32
-
-
Save rbaron/0a3c86476228fcd14a40 to your computer and use it in GitHub Desktop.
Type parameter question
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 Indiv[V <: Indiv[V]] { | |
val fitness: Double | |
def reproduce(other: V): V | |
} | |
class RealIndiv[V](override val fitness: Double) extends Indiv[V] { | |
override def reproduce(other: V) = new RealIndiv(fitness + other.fitness) | |
// ^ Cannot resolve symbol fitness (on `other.fitness`) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment