Base and Derived Classes: class BaseClass{ class func staticMethod(){ println("BaseClass.staticMethod") } class func staticMethodWithSelfCall(){ self.staticMethod() } func instanceMethodWithStaticCall(){ self.dynamicType.staticMethod() } } class…
一.Swift的枚举 枚举是一系相关联的值定义的一个公共的组类型,同时能够让你在编程的时候在类型安全的情况下去使用这些值.Swift中的枚举比OC中的枚举强大得多, 因为Swift中的枚举是一等类型,它除了可以定义枚举值外,还可以在枚举中像类一样定义属性和方法 1. 简单枚举定义和使用 //定义枚举,使用enum关键字 enum Method{ case Add case Sub case Mul case Div } //可以连在一起写,成员之间用","隔开 enum Compass…