I'm studying swift and I'm trying to understand the difference between classes and struct, which as I understand it, is in these two points: 1) Classes are reference types, Whereas structures are value types. That means That When you pass an instance of a structure to a function, return an instance from a function, or assign the value of a variable That Refers to a structure to another variable, the instance is copied. In other words, structures exhibit pass-by-value behavior. Swift strings, arrays, and dictionaries are all Implemented as structures. By contrast, class instances are passed by reference-no copy is taken. 2) Classes can be subclassed to add behavior; structures can not.
why these two errors?
depends on the structure ?, because a class does not give me the same error.