Extending existing data structure in Scala.
Posted
by Lukasz Lew
on Stack Overflow
See other posts from Stack Overflow
or by Lukasz Lew
Published on 2010-05-09T09:19:09Z
Indexed on
2010/05/09
9:28 UTC
Read the original article
Hit count: 208
I have a normal tree defined in Scala.
sealed abstract class Tree
case class Node (...) extends Tree
case class Leaf (...) extends Tree
Now I want to add a member variable to all nodes and leaves in the tree. Is it possible with extend keyword or do I have to modify the tree classes by adding [T]?
© Stack Overflow or respective owner