/* オブジェクトとクラス クラス定義してインスタンス化して利用 */ class Shape { var numberOfSides = 0 func simpleDescription() -> String { return "A shape with \(numberOfSides) sides." } } var shape = Shape() shape.numberOfSides = 7 print("shape = \(shape.simpleDescription())")
/* オブジェクトとクラス クラス定義してインスタンス化して利用 */ class Shape { var numberOfSides = 0 func simpleDescription() -> String { return "A shape with \(numberOfSides) sides." } } var shape = Shape() shape.numberOfSides = 7 print("shape = \(shape.simpleDescription())")