代码之家  ›  专栏  ›  技术社区  ›  Michael Dorner Satyanarayana

AngelScript中的枚举或常量

  •  0
  • Michael Dorner Satyanarayana  · 技术社区  · 6 年前

    在其他编程语言中,我可以使用静态类方法或枚举来封装常量:

    enum Command {
        command_1 = "0x00001",
        command_2 = "0x00002",
        command_2 = "0x00003"
    } 
    

    class Command  {
        static command_1 = "0x00001"
        static command_2 = "0x00002"
        static command_3 = "0x00003"    
    }
    

    1 回复  |  直到 6 年前
        1
  •  1
  •   arie    6 年前

    可以使用命名空间:

    namespace consts_values
    {
        const string a = "aaa";
        const string b = "bbb";
    }
    
        2
  •  1
  •   ThomasZ    5 年前

    enum lock_state
    {
        locked = 0,
        open = 1
    }
    
    推荐文章