I can’t remember but recently in one of the APIs I saw something like this class A (member:A){}
. Scala does support it and there is no problem creating such a class but how do we initiate it and what purpose would such a class serve?
Something like var childNode = new Node(parentNode)
. You’d use it whenever you want a reference to anything of the same type. In this case, it might be reasonable to allow a null-valued parameter:
var root = new Node(null)
var child = new Node(root)
2