ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、视频、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
访问修饰符 override 当一个被声明的字段也出现在父类(第2.3.2节)时是必须的。它的目的是确保类的作者意识到 override 因为这不能总是被明显的在庞大的类层级中。此外,字段有override关键字而实际上没有覆盖任何字段会(例如由于一个拼写错误的字段名)引发一个错误。 > The access modifier override is required when a field is declared which also exists on a parent class(2.3.2). Its purpose is to ensure that the author of a class is aware of the override as this may not always be obvious in large class hierarchies. Likewise, having override on a field which does not actually override anything (e.g. due to a misspelled field name) triggers an error. 重载字段的效果在重载方法(第4.3.1节)详述。这个修饰符只允许用于方法(第4.3节)字段。 > The effects of overriding fields are detailed in Overriding Methods (Section 4.3.1). This modifier is only allowed on method (4.3) fields.