开发者

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 class class 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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜