M
M
Maxim2018-10-27 13:58:37
Swift
Maxim, 2018-10-27 13:58:37

What are instance references?

Good day, ladies and gentlemen.
What are instance references in Swift? The fact is that in the book on which I study Swift, the concept of instance reference began to appear. Maybe I missed something somewhere or something else, but nevertheless, please explain what it is.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
iMaximus, 2018-10-27
@Valter1234

It's simple, reference types mean that when you create a copy of an object, in fact, you simply create another reference to the same memory area with a different name. Reference types are classes and closures.
Values, for example, structures, that is, by creating a copy, you create another object. What is the fundamental difference if you change Class A and its properties, its copy of Class B and its properties will automatically change, since these are just links to the same thing. If you change a copy of the structure, the first one will remain unchanged.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question