diff options
author | schinz <schinz@epfl.ch> | 2003-08-28 09:08:36 +0000 |
---|---|---|
committer | schinz <schinz@epfl.ch> | 2003-08-28 09:08:36 +0000 |
commit | f10b65baef4e685cc70a5cf91cfe5cd4a7cefa20 (patch) | |
tree | dc8da323313b3b2f8c60ea1fe7c0f81df05e180e /test | |
parent | 4409444f4994d1337f78484f0a0e5dc593f013fc (diff) | |
download | scala-f10b65baef4e685cc70a5cf91cfe5cd4a7cefa20.tar.gz scala-f10b65baef4e685cc70a5cf91cfe5cd4a7cefa20.tar.bz2 scala-f10b65baef4e685cc70a5cf91cfe5cd4a7cefa20.zip |
*** empty log message ***
Diffstat (limited to 'test')
-rw-r--r-- | test/files/run/constructors.check | 5 | ||||
-rw-r--r-- | test/files/run/constructors.scala | 29 |
2 files changed, 34 insertions, 0 deletions
diff --git a/test/files/run/constructors.check b/test/files/run/constructors.check new file mode 100644 index 0000000000..0743b7e296 --- /dev/null +++ b/test/files/run/constructors.check @@ -0,0 +1,5 @@ +x=1 y=2 +x=3 y=3 +x=1 y=1 +x=1 y=2 a=1 b=2 c=a +x=3 y=3 a=3 b=3 c=b diff --git a/test/files/run/constructors.scala b/test/files/run/constructors.scala new file mode 100644 index 0000000000..43d2da6af8 --- /dev/null +++ b/test/files/run/constructors.scala @@ -0,0 +1,29 @@ +// $Id$ + +// Test constructors, including multiple ones. + +class A(x: Int, y: Int) { + def this(x: Int) = this(x, x); + def this() = this(1); + override def toString() = "x=" + x + " y=" + y; + class B(a: Int, b: Int, c: String) { + def this(str: String) = this(x, y, str); + override def toString() = + "x=" + x + " y=" + y + " a=" + a + " b=" + b + " c=" + c; + } +} + +object Test { + def main(args: Array[String]): Unit = { + val a1 = new A(1,2); + val a2 = new A(3); + val a3 = new A(); + val b1 = new a1.B(1,2,"a"); + val b2 = new a2.B("b"); + System.out.println(a1); + System.out.println(a2); + System.out.println(a3); + System.out.println(b1); + System.out.println(b2); + } +} |