首页 > 代码库 > Swift_5_类和结构体
Swift_5_类和结构体
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_类和结构体
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。