summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authormichelou <michelou@epfl.ch>2004-09-21 12:17:18 +0000
committermichelou <michelou@epfl.ch>2004-09-21 12:17:18 +0000
commit3bd3a5d23966227601fea21bb6985094183c6199 (patch)
tree0e95427b8088ccc5c8f67e4515b5affebefe6e5f /doc
parentc2c1e5db00a0d62db279825d1309b535d09adde6 (diff)
downloadscala-3bd3a5d23966227601fea21bb6985094183c6199.tar.gz
scala-3bd3a5d23966227601fea21bb6985094183c6199.tar.bz2
scala-3bd3a5d23966227601fea21bb6985094183c6199.zip
- corrected 3 errors in example 4.2.1 (TimeOfDa...
- corrected 3 errors in example 4.2.1 (TimeOfDayVar).
Diffstat (limited to 'doc')
-rw-r--r--doc/reference/ReferencePart.tex10
1 files changed, 6 insertions, 4 deletions
diff --git a/doc/reference/ReferencePart.tex b/doc/reference/ReferencePart.tex
index 2f53de4752..3e660216ad 100644
--- a/doc/reference/ReferencePart.tex
+++ b/doc/reference/ReferencePart.tex
@@ -1124,21 +1124,23 @@ hand, accesses these fields just like normal variables.
\begin{lstlisting}
class TimeOfDayVar {
- private var h: int = 0, m: int = 0, s: int = 0;
+ private var h: int = 0;
+ private var m: int = 0;
+ private var s: int = 0;
def hours = h;
def hours_= (h: int) = if (0 <= h && h < 24) this.h = h
else throw new DateError();
- def minutes = m
+ def minutes = m;
def minutes_= (m: int) = if (0 <= m && m < 60) this.m = m
else throw new DateError();
- def seconds = s
+ def seconds = s;
def seconds_= (s: int) = if (0 <= s && s < 60) this.s = s
else throw new DateError();
}
-val t = new TimeOfDayVar;
+val d = new TimeOfDayVar;
d.hours = 8; d.minutes = 30; d.seconds = 0;
d.hours = 25; // throws a DateError exception
\end{lstlisting}