Skip to content

Commit d3b0267

Browse files
authored
fix: a bug in secondary constructors (#5331)
1 parent 8719c79 commit d3b0267

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

docs/topics/classes.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,7 @@ class Person(val name: String, var age: Int) {
354354
// Secondary constructor that takes age as a
355355
// String and converts it to an Int
356356
constructor(name: String, age: String) : this(name, age.toIntOrNull() ?: 0) {
357-
println("$name created with converted age: $age")
357+
println("$name created with converted age: ${this.age}")
358358
}
359359
}
360360

0 commit comments

Comments
 (0)