码迷,mamicode.com
首页 > 其他好文 > 详细

Swift_5_类和结构体

时间:2014-07-21 16:21:54      阅读:208      评论:0      收藏:0      [点我收藏+]

标签:swift

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")

Swift_5_类和结构体

标签:swift

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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!