While static properties are often declared private to prevent meddling, there is one way of creating a read-only statically scoped property: You can declare a constant.
尽管静态属性通常被声明为private来防止别人干预,但有一种方法可以创建只读静态范围的属性,即声明常量。
You can declare a new NAMESPACE constant, which is implicitly made a constant and from the character data type.
可以声明一个新的NAMESPACE常量,这隐式声明了一个字符数据类型的常量。
It would be better if you could give this constant a name and then use it everywhere in the program. You could, of course, simply declare it as a local variable by writing.
这样的话,如果可以给这个常量一个名字,然后在程序所有需要的地方通过名字来使用这个常量,将会非常方便。
应用推荐