We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents b292ee9 + f874fe3 commit 0afef9fCopy full SHA for 0afef9f
_tour/classes.md
@@ -76,17 +76,17 @@ class Point {
76
private var _y = 0
77
private val bound = 100
78
79
- def x = _x
+ def x: Int = _x
80
def x_= (newValue: Int): Unit = {
81
- if (newValue < bound) _x = newValue else printWarning
+ if (newValue < bound) _x = newValue else printWarning()
82
}
83
84
- def y = _y
+ def y: Int = _y
85
def y_= (newValue: Int): Unit = {
86
- if (newValue < bound) _y = newValue else printWarning
+ if (newValue < bound) _y = newValue else printWarning()
87
88
89
- private def printWarning = println("WARNING: Out of bounds")
+ private def printWarning() = println("WARNING: Out of bounds")
90
91
92
val point1 = new Point
0 commit comments