What would be the appropriate way to implement a file system class structure in scala?
I want the Root to be a Directory and to have itself as a parent.
import scala.collection.mutable
sealed trait Entry
class Directory(val parent: Directory, val content: mutable.IndexedSeq[Entry]) extends Entry
class File(val parent: Directory, val content: String) extends Entry
object Root extends Directory(Root, mutable.IndexedSeq[Entry]())
The attempt above results in:
Error:
(23, 31) super constructor cannot be passed a self reference unless parameter is declared by-name object Root extends Directory(Root, IndexedSeq())
Root.content.