Just wanted to give kudos. I really love the imposter examples in this chapter, especially finding the real instance among the imposters. The examples in this chapter do a great job of clearly conveying the concepts. ![]()
I do have a question though. In this section:
// Since `Person` is a reference type, you can use === to grab the real John out of the list of imposters and modify the value.
// The original `john` variable will print the new last name!
val indexOfJohn = mutableImposters.indexOf(john)
if (indexOfJohn != -1) {
mutableImposters[indexOfJohn].lastName = "Bananapeel"
}
You mentioned using the === operator but then I donβt see that operator being used in this case, rather indexOf is used. Does indexOf() relate somehow to the === operator? If so, perhaps a sentence clarifying this relationship would be helpful. Thanks.