Self refers to type
self refers to concrete object
Example: in this case, Self = Int, self = 10
extension BinaryInteger {
func squared() -> Self {
return self * self
}
}
let a: Int = 10
print(a.squared())
Self refers to type
self refers to concrete object
Example: in this case, Self = Int, self = 10
extension BinaryInteger {
func squared() -> Self {
return self * self
}
}
let a: Int = 10
print(a.squared())