This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Number /* class cluser */ { | |
class Int8: Number { | |
var value: Swift.Int8 | |
init(_ value: Swift.Int8) { self.value = value } | |
} | |
class Int: Number { | |
var value: Swift.Int | |
init(_ value: Swift.Int) { self.value = value } | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
## background | |
When you write a function that mutates the var properties of a | |
mutable struct, this _creates a new instance_.[1] As a result, | |
a variable pointing to a value of this type before the mutation | |
will still be pointing to the old value after the mutation, as long | |
as you did not use that variable to do the mutation. | |