|
Scala example source code file (t1391.scala)
The Scala t1391.scala source codepackage sandbox class hierarOverload { /* * Template structure - using abstract types. */ trait AB { type TA <: A type TB <: B protected trait A { val entities : List[TB] } protected trait B { var group : TA } } /* * Template instantiation in an object to ease use and globally define abstract types */ object NAnB extends AB { type TB = nB type TA = nA class nA extends A { val entities = List[nB]() } class nB extends B { var group = new nA } } def foo () { val t = new NAnB.nA println(t) } } Other Scala examples (source code examples)Here is a short list of links related to this Scala t1391.scala source code file: |
... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2024 Alvin Alexander, alvinalexander.com
All Rights Reserved.
A percentage of advertising revenue from
pages under the /java/jwarehouse
URI on this website is
paid back to open source projects.