Francis Mariano
06/26/2024, 1:13 PMclass QueueExecutorImpl(
private val peripheral: Peripheral,
parentScope: CoroutineScope,
) : QueueExecutor {
I have a simple doubt. In the above class I have two parameters: one with private val and another without any modifier. My doubt is the following: peripheral is a copy and parentScope is a reference for the external object??hho
06/26/2024, 1:17 PMval only makes the class keep it as a field (available after the constructor ends).Francis Mariano
06/26/2024, 1:30 PMval and the reference is modified, the parameter of the class does not change because it is immutable, right? Otherwise, if var or none modifier is used the parameter changes if the reference is modified.Sam
06/26/2024, 1:39 PM"the reference is modified"This is not a thing in Kotlin. You can't modify a reference.
Francis Mariano
06/26/2024, 1:47 PMSam
06/26/2024, 1:49 PMval property, a var property, or just use it as a constructor parameter, you're still referencing the original object.Sam
06/26/2024, 1:50 PMFrancis Mariano
06/26/2024, 1:52 PM