What to use? Parameterized class, abstract class or undefined type in Scala?
I have to implement a small graph library for my small Scala + JMonkey Engine game. Library will deal with shortest path caching for further queries. I will have to attach additional user data (like reference to another object) to my Vertexes and Edges. How to implement this behavior?
With:
1. parameterized classclass Gr开发者_如何学Goaph[A, B] {...}
, or
2. provide abstract class Graph {...}
and implement user data variables later, or
3. provide abstract class Graph {...}
and define type A
inside the class?
Or maybe I'm missing something else?
Here's a good article on this topic
There are also traits which are mix between interface and concrete implementation.
精彩评论