Tag: Swift/関数とクラス
class Person { var age:Int var name:String init?(age:Int, name:String) { self.age = age self.name = name if age == 0 { return nil } } } var person:Person? = Person(age: 10, name: "abc") print(person!.name)
final class Person { init(a:Int, b:Int, c:Int) { } func action(a:Int, b:Int, c:Int) { } }
var person = Person(a:1, b:2, c:3)
person.action(1, b:2, c:3)