Slide 8
Slide 8 text
// 8 byte
class View {
var point: (x: Float, y: Float) // 8 byte
required init(...) { }
func copy() -> Self {
return Self(...) // malloc n byte
}
}
// 24 byte
class TextView: View {
var text: String // 16 byte
required init(...) { }
}
let view: View = TextView(...)
// ͜ͷ࣌Ͱview͕TextViewͰ͋Δ͜ͱΛอূͰ͖ͳ͍ɻ
let anotherView: View = view.copy()
8