preface include: getattr setattr delattr hasattr class webserver(object): def __init__(self,num): self.num=num def stop(self): print("Stop the server !!") def start(self): print("Start the server !!") def restart(self): self.stop() sel
1. 枚举: ->在Swift中依然适用整数来标示枚举值,需搭配case关键字 enum Celebrity{ case DongXie,XiDu,Nandi,BeiGai } // 从左到右对应0,1,2,3 enum CompassPoint { case North case South case East case West //enum中可以定义方法 func show(){ print(self) } } //定义enum 变量 var p = CompassPoint.Nor