Swift
Swift 기초 (4): 클래스, 옵셔널과 nil
클래스 선언 class Shape { var numberOfSides = 0 func simpleDescription() -> String { return "A shape with \(numberOfSides) sides." } } 인스턴스 생성 new 키워드를 입력하지 않습니다. var shape = Shape() // new 키워드가 필요없음 shape.numberOfSides = 7 // 클래스 변수에 직접 접근 가능 var shapeDesc = shape.simpleDescription() 더보기…