Class and Struct
import UIKit
// 유튜브 데이터 모델
struct YoutTubeStruct{
var name : String
var subscribersCount : String
}
var oliverPark = YoutTubeStruct(name: "Oliver Park", subscribersCount: "99999")
var oliverParkClone = oliverPark
print("Before value = Oliver Park Clon : \\(oliverParkClone.name)")
oliverParkClone.name = "Ollie"
print("After Value = Oliver Park = \\(oliverParkClone.name)")
print("After Value = oliver Park = \\(oliverPark.name)")
print("-------class--------")
// Class
class YoutuberClass{
var name : String
var subscriptionCount : String
// Put up on to the memory
// Init 으로 매개변수를 가진 생성자 메소드(func)
init(name: String, subscriptionCount : String) {
self.name = name
self.subscriptionCount = subscriptionCount
}
}
var devPark = YoutuberClass(name: "Oliver Park", subscriptionCount: "1000")
var devParkClone = devPark
print("Before adding the value devParkClone: \\(devParkClone.name)")
devParkClone.name = "호호로오옹"
print("After adding the value devParkClone: \\(devParkClone.name)")
print("After adding the value devPark: \\(devPark.name)")