「Swift」private修飾子のサンプル
サンプルコード
class Sample {
private static var msg = "test data 123456"
func funcA() {
print(Sample.msg)
}
}
let cft = Sample()
cft.funcA()
class Sample {
private static var msg = "test data 123456"
func funcA() {
print(Sample.msg)
}
}
let cft = Sample()
cft.funcA()
class Sample { private static var msg = "test data 123456" func funcA() { print(Sample.msg) } } let cft = Sample() cft.funcA()
結果
test data 123456