| [#32] | project: specification | priority: medium | category: missing feature | |
|---|---|---|---|---|
| submitter | assigned to | status | date submitted | |
| Stephane | Martin | fixed | 2003-06-10 12:57:41.0 | |
| subject | cannot override | |||
| code |
import java.io._;
class PromptStream(s: OutputStream) extends PrintStream(s) {
override def println() = super.println();
}
object Main {
val out = new PromptStream(System.out);
System.setOut(out);
def main(args: Array[String]) =
out.println("hello world");
} |
|||
| what happened | Main.scala:6: method println in class PromptStream of type ()scala.Unit cannot override value println in class java.io.PrintStream of type ()scala.Unit |
|||
| what expected | "hello world" is printed out (as in Java) | |||
| [back to overview] | ||||
| Martin edited on 2003-07-04 16:53:18.0 |
| Martin edited on 2003-07-10 15:42:40.0 |
| Matthias edited on 2003-10-06 12:33:23.0 |
I closed this bug because Martin addressed this issue already. In order to make the code above compile, you have to explicitly type variable out though:
val out: PrintStream = new PromptStream(System.out); |
| Matthias edited on 2003-10-06 12:34:11.0 |