Static fields and methods 静态属性和方法
This is unusual because it requires a developer to create an instance of an object just to access non-instance (static) methods and fields!
这种做法并不常见,因为需要开发人员创建仅用于访问非实例(静态)方法和字段的对象的实例。
Ruby's metaprogramming capabilities let objects magically inherit the methods and fields they need at run time without cluttering up the source code.
Ruby 的元编程功能使对象可以神奇地在运行时继承所需的方法和字段,而不会扰乱源代码。
Support for importing constants: This facility allows static methods and fields to be imported, avoiding the need to use fully qualified class names when accessing static members.
支持导入常量:这个特性使静态方法和字段能够被导入,这样在访问静态成员时就不必使用完全限定的类名。
So inside of an instance, associated with an instance, we have both methods and fields.
还有一些内部变量,实际上我该这么说,我们通常把这些东西称为域。
应用推荐