|
Scala example source code file (nested.scala)
The Scala nested.scala source code
// A non-trivial example of nested classes (mostly to test
// ExplicitOuterClasses).
class A(pa : Int) {
def a1 = pa;
class B(pb : Int) {
def b1 = pa+pb+a1;
class C(pc : Int) extends A(b1) {
def c1 = pc+pb+pa
}
val c1 = new C(66)
}
}
trait M {
val x : Int;
def m1 = x
}
class A1(x0 : Int) extends A(x0) with M {
val x = x0;
class D() extends B(42) {
val c2 = new C(66);
class E() extends C(5) {
def e1 = c1+b1+a1;
def e2 = new D();
}
}
}
Other Scala examples (source code examples)Here is a short list of links related to this Scala nested.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.