Swift_5_类和结构体

时间:2014-07-21 16:21:54   收藏:0   阅读:252
import Foundation

println("Hello, World!")



class PeopleClass{

    
}

struct PeopleStruct{
    
}

struct Resolution {
    var width = 0
    var heigth = 0
}

class VideoMode {
    var resolution = Resolution()
    var interlaced = false
    var frameRate = 0.0
    var name : String?
}


let someResolution = Resolution()
let someVideoMode = VideoMode()

println("The width of someResolution is \(someResolution.width)")

someVideoMode.resolution.width = 12880
println("The width of someVideoMode is now \(someVideoMode.resolution.width)")

let vga = Resolution(width:640, heigth: 480)

println("vga is \(vga.width) \(vga.heigth)")

let hd = Resolution(width: 1920, heigth: 1080)
var cinema = hd
cinema.width = 2048


println("cinema is now  \(cinema.width) pixels wide")

原文:http://blog.csdn.net/yin_xianwei/article/details/38018233

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!