class Program { static void Main(string[] args) { Color color = Color.Red; Console.WriteLine(color.ToString()); Console.WriteLine(color.ToString("G"));//Red Console.WriteLine(color.ToString("D"));//十进制数值 Console.WriteLine(color.ToStrin…
//实现枚举类型,扑克牌应用 function creatEnum(p){ //构造函数 var Enumeration = function(){throw 'can not Instantiate Enumerations';}; //重写原型并将原型赋值给变量proto var proto = Enumeration.prototype = { constructor:Enumeration, toString:functio…
Apple官方文档:The Swift Programming LanguageProtocols and Extensions一节的小节练习,要求自行定义一个enumeration枚举类型,并且遵循ExampleProtocol协议: protocol ExampleProtocol { var simpleDescription: String { get } mutating func adjust() } 在网上找了好久,都不知道怎样实现,最后参照一篇帖子(http://forums.m…