Pau
10/06/2020, 11:51 AMclass Rectangle {
val width: Int
val length: Int
constructor(_width: Int, _length: Int) {
width = _width
length = _length
}
}
val rectangle = Rectangle()
B
class Rectangle {
val width: Int
val length: Int
constructor(width: Int, length: Int) {
width = width
length = length
}
}
C
class Rectangle {
val width: Int
val length: Int
constructor(_width: Int, _length: Int) {
width = _width
length = _length
}
constructor(_sizeA: Int, _sizeB: Int) {
width = _sizeA
length = _sizeB
}
}
D
class Rectangle {
val width: Int
val length: Int
constructor(width: Int, length: Int) {
}
}
E
class Rectangle {
val width: Int = 1
val length: Int = 1
constructor(width: Int, length: Int) {
this.width = width
this.length = length
}
}
F
class Rectangle() {
var width: Int = 1
var length: Int = 1
constructor(width: Int, length: Int) {
this.width = width
this.length = length
}
}
I am a bit confused 🧐
1. Signature uniqueness violation
2. Primary constructor call is absent
3. Reassigning previously
4. Uninitialized properties
5. No values passed for constructor pararmeters
6. Reassigning val because of name collisionVampire
10/06/2020, 12:20 PMtseisel
10/06/2020, 4:36 PMclass Rectangle(val width: Int, val length: Int)
Vampire
10/06/2020, 4:41 PMPau
10/06/2020, 4:43 PMVampire
10/06/2020, 4:51 PMPau
10/06/2020, 4:52 PM