This is my class I am trying to create the following constructor for:
class StatsView(name: String, manager: AssetManager, statistics: Statistics) extends Node(name) with Control {
....
This is the object for which I am trying to use the constructor of Node
object Node {
def apply(name: String) = new Spatial(name) with Node
def apply() = new Spatial with Node
}
trait Node extends Spatial {
My issue is that Node is a trait causing this error message from the compiler:
trait Node is a trait; does not take constructor arguments
trait Node is a trait; does not take constructor arguments
class StatsView(name: String, manager: AssetManager, statistics: Statistics) extends Node(name) with Control {
Hope you can help me.
extendsandabstractkeywords are overloaded in Scala can be very confusing at times. I've always considered that relationship as a restriction on the trait rather than an inheritance relationship, but I guess you could think of it either way. Anyway, I totally misunderstood the issue at hand (I thought he was trying to make a super-constructor call fromNodetoSpatial, notStatsViewtoNode). Sorry about that.