Skip to content

Commit 5177539

Browse files
author
Dean Wampler
committed
Added equivalent examples of using ## as an alias for hashCode
1 parent c2f6839 commit 5177539

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/script/scala/progscala3/objectsystem/hashcode/CaseObjectHashCode.scala

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,12 @@ println(s"O3: ${O3.hashCode} != ${"O3".hashCode}")
1414
println(s"O3.O4: ${O3.O4.hashCode} != ${"O3.O4".hashCode}")
1515
println(s"O3.O4 vs. O4: ${O3.O4.hashCode} == ${"O4".hashCode}")
1616
println(s"O3.O4 vs. O3: ${O3.O4.hashCode} != ${"O3".hashCode}")
17+
18+
// The following section was not shown in the Third Edition, First Printing.
19+
// There is an ## alias for hashCode, but I never use it:
20+
println(s"O1: ${O1.##} == ${"O1".##}")
21+
println(s"O2: ${O2.##} == ${"O2".##}")
22+
println(s"O3: ${O3.##} != ${"O3".##}")
23+
println(s"O3.O4: ${O3.O4.##} != ${"O3.O4".##}")
24+
println(s"O3.O4 vs. O4: ${O3.O4.##} == ${"O4".##}")
25+
println(s"O3.O4 vs. O3: ${O3.O4.##} != ${"O3".##}")

0 commit comments

Comments
 (0)